How the sound system works is not documented in a way that the average person would understand it. They do that on purpose. On many modern computers the headphone switch is not mechanical. Instead, the system can 'sense' that hat you lugged in the headphones. Microsoft may have altered the threshold of that thing so that it does not always work.
But the question is: How much time do your want to send on this?You found a 'workaround. for it.
For what it is worth, here is a 'trick' you can try. Make a new user account, if you only have one now. Then logoff one user and log in to the other. That might make Windows test the headphone jack again to see if the new user likes headphones.
Yeah, I know, it seems to be not logical.
Logging off a user is faster than doing a power off and on again.