I wouldn't go off the deep end yet on the head light problem being the stator. If it was the stator, your battery would not charge either.
To me it sounds like an intermittent connection to the head light from the junction box. There is a wire or connector that is making intermittant contact somewhere in the system. I'd start from the headlight bucket and work toward the junction box. It may be as simple as the connector to the headlight having worked loose and causing the problem.
Had the same issue AFTER a stator & R/R change recently.
Found two issues in particular, the small brown wire from the Ign. switch (it also runs through several connectors that are suspect) was not making good contact with the R/R, this wire (as well as I can understand it) tells the R/R it's time to do something. If this wire is bad, open, or shorted, etc. the R/R will not send a charge signal to the J-box circuit that triggers the relay for your headlight.
The second issue was the connection at the R/R, the spades had become loose and when I greased them up (I've relocated the R/R to outside the frame) it exacerbated the issue.
I pulled the plug, re-cleaned and removed the spades and crimped them (carefully) with a small needle-nose pliers and re-inserted, just for grins, I placed a high-quality heat-resistant tie-strap around the plug to ensure it would not vibrate loose.
Hope this helps some, got mine working great now (well, it's actually the wife's, so it is even more importnat that it works well!).