Problem is that after merging the object with a reference to some other entity with inheritance (is one of the superclass's discriminator map), the referenced object has wrong instance (it is Proxy object). It is instance of the superclass not the extended class.
In my test case I have joined inheritance model with only two entities to make things simple as possible.
First is the base entity (I have even marked it as abstract):
and one entity which extends from the first one:
In this scheme I've got 2 objects, first referencing to the second. They both are inserted in the database with no problems.
After the flush I try merging the child entity into the entity manager, the parent entity reference is not instance of Entity\Entity anymore.
You can see full test case in the archive attached.