I had the same problem too just before an MOT a few years back. As it’s only a momentary switch I had a suspicion that it might be a lazy under used relay. Started the engine to raise voltage and sat there repeatedly pressing the switch with the headlights on. It came back to life after a short while and has been fine ever since. I do press it to check and exercise it occasionally now.