Require cmd+Q to be held for a couple of seconds before quitting on macOS. This is how it works in Chrome, and I think it should be the norm for all tab-based apps. With the Q key being right next to the W key, it's very easy to accidentally press Q instead of W and have to wait for the whole app to reload, on top of losing all your page states.
This is a somewhat controversial feature in Chrome, though - some people seem to dislike it (although I feel it's a net positive), so it should be a configurable option (it's probably too complex for standard settings, so it'd be in `about:config`).