Hello, this is a huge necro but I made an account just to post this. I've been experiencing this very issue for months on the M1 iMac. I'm a total Mac noob who began on Big Sur.
The problem happened in Big Sur, I thought it was going to be amended in Monterey, but it didn't.
On Big Sur, you have to Factory reset all connected devices. Go to the advanced bluetooth menu via "shift-option-bluetoothicon", and "debug bluetooth > reset the bluetooth module" and/or "> factory reset all Apple-connected devices".
Sadly, this option got removed in Monterey. So for Monterey the solution is to turn off the Magic Mouse for a few seconds, and then turn it on again. Completely unintuitive, I know. If you have some text-input access without the mouse you'll notice that the problem is gone while the Magic Mouse is off.
I think the source of the problem might be Bluetooth interference. Which is odd because these peripherals cost a lot of money, but it is what it is...
Hope you have a nice day