When, if ever, does the system finally shutdown after 5+ hours....?
About all that I can think of, and there may be other ideas, is that the heat is involved.
Something gets hot, expands, and then connectivity remains physically intact despite switches being open etc..
However, more information is necessary to determine if heat is involved. I have no vested interest either way...
Especially because, sooner or later, the PC would cool down and return to normal/shutdown.
= = = =
Next time the system is booted look in Reliability History/Monitor and Event Viewer.
The objective being to discover what the system was doing or trying to do prior to any shutdowns. Or trying to do when the system was being shut down.
For example, the system may have been trying to finish up some update that got hung up and never could and never can finish.
Look for error codes, warnings, and even informational events in Reliability History and Event Viewer.
Start with Reliabilty History: much more end user friendly and the timeline format can be revealing - some pattern of events perhaps.
Event Viewer requires more time and effort to navigate and understand.
To help:
How To - How to use Windows 10 Event Viewer | Tom's Hardware Forum (tomshardware.com)
Another possibility is some process running in the background that prevents the PC from shutting down.
Look for that process also. Perhaps trying to update, backup, or simply "phone home".