Inverse Kinematics constraint with pole target Salutations,

I am currently trying to make a rig for a project involving 2D planes to create some kind of equivalent of DragonBones in Blender (I'm working on Linux and DragonBones isn't available there plus I thought this'd be a good way to learn rigging).
I am using inverse kinematics and managed to use the "Inverse Kinematics" tab to have my bones only rotate around the x-axis. It worked quite well but on certain angles, the bones would bend the wrong way. I decided to add a pole target to fix this and it kinda does but apparently using a pole target nullifies the effect of the "Inverse Kinematics" tab and now I have my bones rotating in ways that I don't want them to.

Does anyone know how I could have both a pole target (or any way that wouldn't make the bones suddenly bend the other way) AND restrict the rotation around the x-axis ?
Maybe I'm wrong and someone will find a solution with the IK limits but it looks like you can't prevent the knee twisting this way.

You need to use your Pole Target bone to fix the problem, and anyway the Pole Target is here for that.

So, in Pose mode when you see that the leg rotation make your knee twist in the bad direction, just move the Pole Target and give it a Keyframe so that the knee comes back to the right bending.