I find it hard to believe that even in the Middle Ages people were ignorant enough to think any animal had it sex glands in its head

It does seem weird. However, as I suggested earlier, it does appear to be connected to "metaphysical" viewpoints of the body (Galen's humours and whatnot), which were still prevalent in 15th C, probably later:


In the Galenic model, both men and women were believed to have "seminal vessels" that carried sperm to its point of exit; at the end of the fifteenth century, Jacopo Berengario da Carpi affirmed that these vessels must be longer in the male because male semen was "thicker." How male sperm was generated was a source of some speculation. Did it come directly from the brain via the spinal cord? Was it concocted from purified blood? "The semen is a superfluous nourishment of the body, a material pure and separate from the principle members necessary for generation," wrote Alessandro Benedetti in 1497. " It is believed on the authority of Galen that it is drawn from the brain."


http://www.stanford.edu/class/history13/earlysciencelab/body/femalebodypages/genitalia.html (scroll down the page, or do a Find on "brain")

If you have a well-established but incorrect underlying theory, the conclusions reached in theoretical areas are bound to be a mite unusual. "Sperm in the brain" is quite at home when set alongside a belief in personality being dictated by imbalances of blood (sanguine), phlegm (phlegmatic), yellow bile (choleric) and black bile (melancholic).