Thanks. It has been 24 hours since the phone restarted all by its own. I really don’t want to factory reset it yet. But yes, thanks for sharing it. If it happens again, I d rather replace it

If it helps, found this feature in the settings. It will verify your passcode before powering off.