Obviously caffeine makes things worse for you.
I suspect the caffeine might be increasing insulin resistance, meaning your body and your brain as well
are not handling glucose as efficiently as you would like.
The other notable implication would be caffeine's effect on the acidity levels in your body.
If your overall diet is causing an acidic environment in your body (lower PH), then caffeine would only make it much worse and possibly burden your body's buffering mechanism which keep your PH levels stable.
Coffee consumption lowers the absorption of magnesium, which is a vital mineral for many bodily functions, including cognitive.
Caffeine also affects vitamin B-1, inositol, B7, potassium and zinc levels, and it can interfere with the assimilation of calcium and iron, making it tough to fight Candida (yeast overgrowth infection).
Candida could be an issue for you, so look into it, as some of the symptoms you have are consistent with candida symptoms.
Candida could be difficult to diagnose, but you can do
your own saliva test for it, so you can at least have an idea. Just do an online search.
An anti-candida and alkaline diet would be probably helpful for you. Probiotics, omega-3 s, lots of fresh vegetables, low carb, no sugar, no white flour, no sweets, very little caffeine ( just enough to avoid withdrawal symptoms and taper down) no junk foods, quality protein and oils like coconut oil for cooking, olive oil fresh to drizzle over foods will likely benefit you.
And if you have stress, try to take measures to lower it!
A lot of these symptoms sound like diabetes.