I think this is pretty common. If I don't swallow a couple of Ibruprofen after an enduro I get a headache a couple of hours later. Pretty sure it's concentration tensing the neck & face muscles. I don't get it trail riding because I'm more relaxed and there's plenty of breaks. It doesn't seem to matter how much or what I drink although if you dehydrate it'll be much worse. 3 - 5 hours of racing is a lot of concentration! Sometimes after a very tiring race, when I go to bed, I find myself still riding the course in a semi dream state
The wife just loves me to describe every detail of the race while she's trying to get to sleep. I find that helps me to relax, she seems pretty tense after for some reason? I try telling the dog too but he just groans and puts his paws over his eyes.