Help needed with flipping bones that are constrained

I am having some difficulty figuring this out so I’m hoping someone can help. I have a character rigged that is mechanical in nature, and I’m happy with how everything works with traditional keying. The problem I am having is with trying to apply motion capture data to that rig, where I get a large amount of flipping.

I need to find a way to apply the captured data to this model. Things like the wrist and fingers need to be restricted to single axis rotation as you should be able to see in the example. I’m not concerned about the actual range of movement in this example, just the flipping problem. Since the motion capture data does not have this flipping, I know it is getting added through the constraints I am using, and I don’t know how to get around this.

I cannot share the entire character, so I have recreated a simple example to show the issue better. On my actual model I have another armature in between to allow for adjustments, but the issue is the same as it is on this simple setup.

Here is a link to a sample .blend
https://pasteall.org/blend/e4a3d6ea0a784480ad0f3dd94cb1216d

Thanks for any help!