In System Settings > Keyboard Shortcuts > App Shortcuts, add the shortcut: app Safari, name "Quit Safari", command-option-Q. This will leave command-Q doing nothing, yet still allow you to quit. Repeat for other apps.
You can't do that because the design of the whole system is dumb - instead of matching by unique (within the app) universal (=across apps) menu item id like "quit" that's hardcoded into the framework, you must match by menu item displayed name "quit Safari", which is different for every "quit MyNewShinyApp"
PS: and sometimes the name string is also dynamic "Navigate to the latest folder named XYZ", so you can't match at all!