Unfortunately, there is probably nothing to be done about that on our side. Windows decides to change the output mode when something overlays over the video, as it changes the rendering mode when it no longer has a sole single window to render.
It does not happen for me like that, which could depend on the screen itself, or which version of Windows you are running, or some other parameters. HDR behavior was much improved in Windows 11, for example, compared to Windows 10.
Additionally, if for some reason you turned off "Multi Plane Overlay" (MPO) in your OS, having that enabled might also help prevent that problem. But MPO is a bit limited especially when you have multiple monitors, and seems to only be active on the primary monitor. I'm told this is actually improving in the forthcoming Windows 11 update later this year (24H2)