If it is indeed a seed that has formed inside the bud, then that bud has somehow become pollinated. A mite infestation coupled with heat stress, nute burn, etc., is generally more than enough to cause a hermie. Maybe you just didn't notice the male pod before or after it opened up and cross-pollinated itself.

Another possible reason could be that you accidentally pollinated it by coming in contact with pollen somewhere, and transferring a single grain to the female when you went into your grow room. This is actually more common than you might think, and is why it's recommended that you don't enter your grow room immediately after being outside, in the woods, at another house where blooming males are present, etc. You aren't going to notice a single grain of cannabis pollen that happens to land on your shirt, and of course, you wouldn't notice if that pollen were to fly off of your shirt, and on to one of your flowering females.