I am making a rig-based FPS character and have a problem animating an Animation Rigging IK bone

So I am making an FPS character with a character model, and I am applying Animation Rigging IK for the leg. It is a typical 2-bone IK Constraint leg with a hint object and a target object, one located in front of the knee and the latter behind the foot. It works fine. The problem is when I rotated the entire character in the Y axis with mouse via script, it slightly deviates the position of the foot while an animation is running.
This is the how i do the rotation :

transform.Rotate(Vector3.up * mouseX);
#mouseX is the mouse input value


This picture above is the character, with an idle animation running. I then rotate the character around 90 degrees left and the leg deviates like this :

its as if the foot ik has a completely different pivot point than the parent objects. How do I mitigate this so the foots always align and that it rotates properly?

Which bone did you rotate on the character?
If you need a parent pivot for hips, add RigTransform above foot ik.
https://docs.unity3d.com/Packages/com.unity.animation.rigging@1.1/manual/RiggingWorkflow.html#rig-transform

I rotated the whole character

It looks like ik target(under twoBoneIK rig) control by other script,
make sure to update the ik target position or set the weight to zero while ik control script been disable.

Thanks for the help, it turns out the rotations worked a bit differently depending on the position of the hint and and the target, its fixed