@kourosh6: If you head to Settings > Battery and device care > Auto optimisation > Restart when needed, and toggle this option off, does this resolve your issue?
Okay so I've done the recovery menu thing and cleared the cache partition which itself didn't stop the restarting so after that I ran a graphics test and it flagged an error and automatically deleted it. I also pressed the repair app one too. So far no restarts 🤞 might be worth a try.