fixating rotation around a dynamicly moving plain
When you click r for rotation you can limit the rotation on world axis by hitting ( xy or z) or on local axis ( xx, yy or zz)

first place the bones in a good way   


rotate around the local axis
or 
select the bone in pose mode 
in Bone Constraints add Limit rotation constraint
setup the constraint according to your needs (in this case see the image ) 
now the bone will only rotate around the desired axis


Bones setup:

    

Bone constraint :



result :