For the headlights going on/off, inside the headlight switch is a circuit breaker. if the current to the lights exceeds the breaker set point by heating up the breaker trips. When the temperature comes back down the breaker resets. It's should do that so you could limp home night and get a new switch later and fix the current problem.
John69... it seems like the headlight switch might need to be checkout out to see if it feeds power to the lights. if the daytime lights remained on when you switched on the lights, that's another indication of the switch because power out to the lights goes to the running light module lamp feed which should have told the module to turn off the running light relay, and it should have gone dark when you made the switch. probably another safety thought from GM.
The daytime running lights power feed is on a separate feed, fuse, and path, not through the headlight switch.