How to fix Galaxy S9 “Unfortunately, phone has stopped” error [exhaustive troubleshooting guide]

How to fix Galaxy S8 Plus that restarts by itself and having trouble turning back on