Prevent restarting Mac by accident
More than likely, you hit Control⌘ Command and the ⦿ Power button .

That's the only keyboard combination that will force restart a Mac without asking you to save unsaved documents.  The only other way to shut down a Mac without it prompting you is to hold the ⦿ Button for 5 seconds.


  Question is there a way to require that the use respond to a confirmation dialog before shutting down / restarting their Mac? 


There are key combinations that already exist with confirmations:


Control⌘ Command⏏ Media Eject - Quit all apps, then restart your Mac. If any open documents have unsaved changes, you'll be asked whether you want to save them. *
Control⌘ Command Option ⦿ Power Button or Control⌘ Command Option ⏏ Media Eject - Quit all apps, then shut down your Mac. If any open documents have unsaved changes, you'll be asked whether you want to save them.*


* Doesn't apply to keyboards that have a Touch Bar.

It's probably best that you familiarize yourself with the keyboard shortcuts that are set by default in macOS