This has started happening to me too recently, out of the blue. But only after my Mac Mini has been in sleep mode.
When I wake it up and unlock to start using again, the focus keeps jumping away from whatever I'm trying to use, making the computer impossible to use. Reconnecting keyboard and mouse has no affect, nor does restarting applications.
The workaround seems to be to log out and back in again, after which this stops happening - until after I've put the computer into sleep mode again later in the day.
Both my keyboard and mouse are using the LogiTech wireless USB dongles, so Bluetooth is probably not involved.
I'm on Tahoe Version 26.2 (25C56). I can't say for certain, but this issue seemed to kick in after the last Tahoe update some weeks ago.