Back to the op,s original question I had exactly the same thing recently and it ended up being the starter switch.
First thing I noticed was the lights not coming on, then a bit later the starter wouldn’t engage.
After checking the connectors under the tank I removed the handle bar switch, and as per previous advice, found that the connectors in the switch were compromised. Pulled the switch apart, cleaned contacts, put it back together, and it’s been working just fine ever since.
I have a new switch as a replacement and will swap it out when I do the valve clearances in a few km,s time.
That way I have a working second hand spare just in case.
I read Lots of advice about how you must really upgrade with headlight relays, but mine worked just fine for 100,000 km and 14 years, so I take all that with a big pinch of salt.