Elbows and knees getting deformed

Seems as if the bones moved, although I didn’t move the bones at all in Blender, it’s the exact same rig with exact same bone positions/rotations.

I did manage to fix the knees by moving those bones but the elbows just get worse if I try the same.
In this screenshot it’s after moving the knees bones, the elbow bones are default and looking like that.
It looks fine in idle (the knees didn’t look fine in idle until I fixed it by moving the bones).

Here’s how I set up the knees so they don’t look broken:

Here’s how the elbow deforms in Blender if I rotate the bones in pose mode: