I think it can. Plants aren't human. Frogs have been known to switch sex when there aren't any females around. Some will switch sex and become female (or it might be the other way around, but they can switch sex). There's a species of crabs that start out male, and throughout their lives they change sex several times. Yes, I think sex is determined by genetics, but I also believe that environmental factors can affect the gene expression (aka phenotype). There are lots of examples of environmental factors that affect the expression of genes.

Most cannabis plants probably have a certain level of predisposition towards hermie. It's probably due to natural selection and evolution. Remember, cannabis like all other has evolved to propagate it's genetic material (that's why sex feels so good for us humans, it ensures propagation of the species). A plant that has the ability to go hermie and self pollinate stands a better chance of survival than one that does not.

Some of course, due to selection of breeding stock are more hermie resistant (ie C99), and some just naturally hermie even if given good environment (thai's show this trait).
One little mishap in a light cycle won't or shouldn't ruin everything though.