You description of your normal caffeine intake makes it unlikely to be a withdrawal problem. I drink five or six cups of very strong at a minimum and sometimes up to eight or nine cups, and that level can give me a morning withdrawal headache that is remedied by another cup. My guess is that you were dehydrated. You mentioned going to the toilet regularly on the flight.
If it happens again, force yourself to drink a large quantity of plain water. Often that is all that is needed. The same thing is good for hangovers, only drink at least one large glass before sleeping. When I get what is certainly a caffeine withdrawal headache, and no coffee is available, a litre of water has the same effect.