That seems to have started in Photoshop 2020 (ps ver 21.x.x) when one is using Floating Document Windows.
Doesn't occur with tabbed document windows.
One the Mac side with tabbed document windows and the Application Frame on the issue doesn't happen.
Photoshop versions from CS4 to 2019 seem to work right.
That is, when one has a Floating Document Window and using the Rotate View Tool, the image stays centered in the document window when rotated as opposed to being out of center when rotated in Photoshop 2020 to 2024.
had been reported several times in the past
https://community.adobe.com/t5/photoshop-ecosystem-discussions/photoshop-rotate-view-tool-rotates-but-moves-the-image-from-my-work-area/td-p/13745301
https://community.adobe.com/t5/photoshop-ecosystem-discussions/problem-while-rotate-zoom-in-out-in-photoshop-2020/m-p/10737326
https://community.adobe.com/t5/photoshop-ecosystem-bugs/p-rotate-view-with-floating-window-relocates-view/idc-p/12670724
You can get around this particular issue if you go to Edit>Preferences>Tools and check Overscroll.