This is a little script that will add a Copy Transforms constraint to the bones in an armature.
It will try to find an object with the name of each bone. Then add the constraint if the object is found.
import bpy
arm = bpy.data.objects['Armature']
for bone in arm.pose.bones:
name = bone.name
if name in bpy.data.objects:
copy_transform = bone.constraints.new('COPY_TRANSFORMS')
copy_transform.target = bpy.data.objects[name]
If the animation looks ok when the constraints are in place, you can bake it down to it’s own Action.