For anyone facing the same issue while importing a solution with the opportunity_originating_lead relationship but no unmanaged changes in the target environment, here’s what I found:
There is an AttributeMap table in D365 that stores individual field mappings, where each record represents a field mapping within a relationship. All of these AttributeMaps are linked together under the EntityMap which is associated with the relationship.
In my case, there was another Managed Solution that I imported a while back in the QA which had ownership of these AttributeMap records. Since there is no direct way to view solution layers for the AttributeMap in D365, I used FetchXML Builder in XRMToolbox to display all the AttributeMaps associated with the EntityMap that was throwing the error. The solution field in the result showed that the ownership belonged to the older Managed Solution.
In the main solution upgrade I was importing, I had added the opportunity_originating_lead relationship and had removed some of the field mappings(AttributeMaps) from it in DEV. However, in QA, the AttributeMaps I had deleted were owned by the older Managed Solution, which prevented their deletion during the import of my Main Solution and triggered the EntityMap error.
I resolved the issue by adding all the components from the older Managed Solution into my Main Solution in DEV and then deleted the older managed solution in QA. After doing this, I was able to import the Main Solution without any issues.
Alternatively, If you don't want to delete the older Managed Solution in QA and you're okay with keeping the field mappings, a temporary workaround would be to add back any field mappings you may have deleted. This will also allow the import to proceed successfully, but it’s not a permanent fix.