I did some more research and found this which makes sense.
When you rise during squats, the blood pressure in your head decreases. This sets off a reflex intended to maintain the supply of blood and oxygen to the brain so you don't black out: neurons (nerve cells) release a neurochemical, adenosine, which dilates blood vessels in your head and neck. That increases blood flow to the brain and keeps you conscious.
Normally this reflex doesn't cause pain, but your neurochemistry is abnormal because of exposure to caffeine. Caffeine blocks adenosine, so your nervous system has adapted to chronic exposure to caffeine by becoming more sensitive to adenosine. That adaptation allows you to function fairly normally despite the presence of caffeine. Unfortunately, that adaptation has also rendered you susceptible to headache.
Solution: gradually decrease your caffeine intake from all sources over a number of days. As you decrease your caffeine intake your neurochemistry will normalize, and you'll become increasingly resistant to headache. The reflex release of adenosine that dilates blood vessels in your neck and head when blood pressure in your neck decreases will stop causing head pain.
Don't abruptly quit caffeine, as that could induce severe and unpleasant withdrawal symptoms.”