Analytical Chemistry predicting the order of elution of compounds in a reverse phase HPLC
The logic is wrong. Lower $\mathrm{pH}$ (actually you mean $\mathrm{p} K_\mathrm{a}$ here) does not mean more polar.

It is more complicated to decide the polarity then you think. For reverse phase HPLC, the more polar and more soluble compound come out first. For reverse phase HPLC, it is common to have acid (TFA for example) in the eluent. It this case, caffeine can be protonated and become much more polar because it is ionic now. Solubility is another factor to consider. So if you want to predict the order, you have to provide more information.