Phone is restarting itself and booting into TWRP suddenly

I am unsure what is happening here but something must be very wrong because since I have enabled logging my phone will not properly lock. I can lock the phone by pressing the power button and if I try waking the phone using the power button it works… but if I press the home button it just bypasses the lock screen altogether.

I am going to re-flash the phone, use the latest e os for my phone and assume this is the correct solution, thanks to anyone who tried to help.