Find submesh and replace with instances
you can write a script to separate every object into loose parts.
Then for every object do a unit_test_compare with the data of the other object if the result it's "Same" then make it a linked duplicate, but before copy the world matrix to not loose the position scaling and rotation and apply it to the newly linked duplicate
ie.

print(firstObj.data.unit_test_compare(secondObj.data))


will yield to the string "Same" if they are the same and "Number of verts don't match" for different objects

Let me know if this is not enough

edit : possible duplicate answer