Python, How to Convert Rotations of T-pose Pose Bones in Armature 1 to Pose Bones in Armature 2? Finding Rotational difference
The primary problem is that blender doesn't update matrices automatically after setting by code and the secondary problem is setting correct matrices. check the same kind of problem which I have answered here:
How can I copy the location and rotation of multiple bones of a skeleton and paste them to an identical skeleton?