This issue happened to me today for Both Marvel Rivals and Destiny 2. I have a LG 34 Inch Ultra Wide but prefer to run my games via a 16x9 Fancy Zone that I enabled auto snap on and I remove the borders with the BorderlessWindowGaming Tool. I have been using it for a year and it also has a Lock mouse to Game Window Feature as well.
However my was caused by the X-Box Game Bar. I connected a my new X-Box controller via bluetooth for the first time to my PC via and via bluetooth and the issue suddenly started happening after I messed around with the Game Bar as I thought it was a "cool feature". Unknownly opening Gamebar with the wireless controller configuration caused the issue of the mouse leaving the window for me. After trying to use Co-Pilot to solve it one of the suggestions was another forum post stating that Game Bar was the issue for them. I disabled it via task manager, restarted the PC it has since been fixed it for me.
Hope that helps anyone with the frustration as well. Though I had the BorderlessWindowGaming tool set to snap to window. Gamebar was able to override it and cause me much furstration in my gaming session tonight.