That is a strange issue but normally these types of issues are related to one of two things.
First the battery is weak, and it is causing odd things with the electronics, namely the lighting.
So, I would suggest we test the battery and the alternator using these guides and make sure they are okay to start.
Next, we need to make sure there is no ground issue with the battery or headlights.
We do this by checking the terminals at the battery and make sure they are clean and tight.
I then provided a wiring diagram to check the grounds with the switch and lights.
If none of this checks out, then I suspect you have an issue with the smart junction box. These are common to fail and cause all sorts of odd issues like this so the way to confirm this is when the lamp is out to check the voltage coming from the logic board of the SJB.
Please run through this info and let me know what questions you have.
Images (Click to enlarge)
Saturday, March 5th, 2022 AT 3:28 PM