Switching from ThirdPersonView to FirstPersonView while maintaining the aiming point 100% accurately

So I have a character in an FPS game that I can switch from TPV to FPV and vice versa, the TPV camera gets its view from a camera on a spring that is attached to the character’s mesh, and the FPV camera gets its view from a socket that is attached to the head of the character’s mesh.

What I need to do is that when I am aiming at a point in TPV and want to switch to FPV I want to be aiming at the exact point in FPV mode.

The way I first approached this is by doing a linetrace and then registering the hit location of the first thing in my aim direction, afterward I get the hit location and calculate the vector between the hit location and the FPV camera location and then I set the control rotation to this vector, normally this would work if the FPV socket was directly above the root because any change in the rotation of the root bone will only affect the rotation of the FPV socket, but what happens is that the FPV socket has an offset from the root in the (X, Y) direction this means that any change in the root bone rotation will not only change the rotation of the FPV socket but its location too, and since the FPV camera location is attached to the FPV socket that means that the aiming direction will not be aligned with the original hitpoint.

I have also tried iteratively to approximate the aiming direction by updating the rotation of the character multiple times per frame but this won’t be 100% and there will always be edge cases.
How can I handle this problem?