IMO people worry about this issue of stray light during flowering WAY more than they ought to.
Obviously cannabis plants normally flower fine just outdoors where they naturally get exposed to moonlight on most nights. Yes, full moon night is a bit brighter, but its not the only day of the month where there is moonlight!
No, of course you don't want to run your grow lights during the dark period if you can help it, but I can say from experience that its actually quite difficult to make a plant that's well into flowering revert to vegetative growth. You sure as hell are NOT going to do that with just a minute or two of ordinary room light, let alone a few minutes of "safe" light, like a green light, etc. That's even more true if the light exposure occurs during the very beginning or end of the 12-12 cycle, so that the plant still gets multiple consecutive hours of darkness.
On hermies, yes, stress will play a role there, including light stress, but again, IMO that's mostly genetics.
There are plenty of stable strains that won't make hermaprhrodite flowers virtually no matter what you do to them.