Pure conjectural or anecdotal but it is my intuition that there is something to it
EDIT: My running theory is related to hormesis or tolerance where the body produces an opposite effect to the ligand to maintain homeostasis and there is not a sufficient dose of the exogenous drug taken to override the body’s compensatory reaction
So even tho caffeine is a stimulant (adenosine antagonist) it actually causes the body to produce the opposite reaction, causing the reverse effect of making you sleepy
Also, wild and vivid dreams.