This has been happening ever since I got this PC and Windows 10. I have headphones with a normal 3.5mm jack to plug into the front of my Tower.
Yet a lot of the time, unplugging them to use my normal speakers trips the system into Sleep mode.
The system is set to NEVER go to Sleep mode in the Settings "Power & Sleep" section.
But it also doesn't always happened. I was just playing Elder Scrolls Online with the headphones in. I unplugged them, Sleep Mode.
There is no real way to replicate it. It literally just happens randomly.
Using a video player. Sometimes if I have a video paused and the headphones are in, and unplug them to let speakers run it, it goes to sleep mode. Sometimes it doesn't.
It's all centered around this Headphone Jack, as far as I can tell, but I have no clue how to stop it from happening. It's just extremely annoying.