Something similar to what you describe is already being done. Game video is streamed to a Raspberry Pi Zero that sits between the real mouse and the Gaming PC and adjusts the mouse movements. Google for
"Valorant RPi0" for videos to see this in action.
Here is an excerpt from a now deleted Reddit comment where the setup is described:
> "My pi is connected to my pc as a HID device with all the descriptors matching a legitimate mouse. My actual mouse is not connected to my pc and the movements are relayed through to the pi over wifi (UDP). My pc records my screen and streams info to my pi over wifi which my pi happily adjusts as seen in the video."