I get that as well. As far as I understand it, and someone is welcomed to correct or expand on any of this - this is because when you play a game (primarily when using gamemoderun), it disables your compositor. When you exit the game, it kicks the compositor back on. I have no idea why it has issues on coming back on, seems to be related to Nvidia in X11.
Some things that I've found that help is disabling the compositor (Alt+Shift+F12)
After doing that, I try to maximize and un-maximize any windows I still have up, then re-enable the compositor with the same shortcut.
Realistically, your plasmashell solution is great. Theoretically, Wayland shouldn't have this issue, but I know Wayland comes with its own issues with Nvidia.