How To Get A Quaternion Camera Rotation That Is Independent Of View Orientation
I've never experienced myself the specific problem that you are talking about, so I don't actually know if this fixes it, but you are able to change the rotation mode for the camera from XYZ to Quaternion.

The image below shows the setting being changed in the properties panel.



I hope this helps! (but it might not, idk)