At least on Windows 10 Home, I wasn’t able to exactly re-create this. However, I did notice some similar issues whenever interacting with the game window, especially when in windowed mode. For example, it was difficult to move/resize the window since the mouse would get captured as soon as you started interacting with it.
I was able to avoid those issues by explicitly detecting when the window is unfocused and changing the mouse capture behavior until the game is focused again. I think it’s pretty likely this will address what you’re seeing as well.
This fix will be included in the next update, which should be coming soon, once I finish up testing.