For anybody using MacOS, a keyboard customisation program called Karabiner-Elements can help here. By importing a specific KE rule, you can change the behaviour of your keyboard such that a Cmd-Q code is only sent after pressing the key chord twice. IRL this translates into a singular press and hold of Cmd and a double tap of Q and it works on all programs. I can't recall accidentally closing any program since enabling this rule and it takes next to no extra effort to work with it enabled.