2018 Mac mini random restart problem
Last week, I had a similar problem with my MacBook Pro performing uncommanded restarts. I solved it by performing a reset of the System Management Controller.
From Apple's Support page: https://support.apple.com/en-us/HT201295:

Desktop computers

Shut down your Mac, then unplug the power cord.
Wait 15 seconds, then plug the power cord back in.
Wait 5 seconds, then press the power button to turn on your Mac.