From everything I've read, it doesn't sound like a single gene, but rather a bunch of independent traits. Using silver-based chemicals (colloidal silver, silver thiosulfate) to block ethylene in the plant causes female plants to produce male flowers, but lots of stresses can also cause similar hormonal changes and trigger intersex traits in female plants. The genes may affect the thresholds for panic responses to particular stresses, rather than being some "herm"/"not herm" genetic switch -- some will get stressed out very easily by topping or excess nutrients, some might need really intense temperature or pH swings before they're stressed enough to do it? Also, in Marijuana Botany, Clarke mentions several landraces being really prone to it (especially Thai), to the point of being practically monoecious.
I tend to think of it more like the cannabis equivalent of some people getting cold sores when their immune system is busy fighting off other things, but that's me. (Granted, that's viral rather than genetic, and from the plant's standpoint it's a last ditch effort to reproduce and survive, but the idea is that from the grower's standpoint it's a usually-dormant annoyance that can be triggered by stress.) Thinking of it in terms of human sexual expression is probably a misleading mental model.