It's been a personal experience. I am at home now and take tea twice a day. For 2 months now I have been having acidity problems, which, my doctor told me, were the main reason I have been getting gags the whole day. I had quit taking tea ceterus paribus and have noticed that frequency of getting gags has drastically reduced. I am curious: can tea or any particular component of it cause acidity which eventually causes people to feel like retching?
I haven't found any studies that would directly link retching and the consumption of tea. However, this would be a rather narrow research, so the lack of it is no surprise. Your doctor told you that your acidity problems may be caused by tea and that this might be causing your gags, and they are correct.
It has been proven that consumption of tea is directly related to increased secretion of gastric acid (1):
The gastric acid response to a 200-ml cup of tea was measured [...] Tea resulted in an acid secretory response which was almost equal to that after a maximal dose (0.04 mg/kg) of histamine. The effect of tea was mainly due to its local chemical action on gastric mucosa. Tea without milk and sugar resulted in an acid response higher than that evoked by a maximal dose of histamine. The concentration of tea brew that had the greatest effect on gastric acid secretion was 15 g/200 ml, which was three times as much as that in a palatable cup of tea. Tea is a potent stimulant of gastric acid, and this can be reduced by adding milk and sugar.
This effect of tea is most likely caused by caffeine, which was proven to increase gastric secretion in animals and humans. (2, 3)
Therefore tea can have some adverse effects (4):
Green tea and green tea extracts contain caffeine. Caffeine can cause insomnia, anxiety, irritability, upset stomach, nausea, diarrhea, or frequent urination in some people.
*Some sources state that increased gastric secretion and possible irritation of gastric mucosa are caused by chlorogenic acid and tannins, which is why these effects are reduced by addition of milk. Other sources, however, state that both chlorogenic acid and tannins reduce gastric secretion.
I battled the exact same issue you had. It was coughing fits and gagging that went on for almost a year.
I tried the many different things ranging from sleeping more, to gargling salt water in case it was bacterial or related to tonsil stones, to allergy medications in case it was post-nasal drip, reducing stomach acidity at night and inclining my bed in case it was acid-reflux. These only had a minor impact on the problem.
Certain things triggered the gagging instances including dry air, the a/c turning on (more dust), cream, coffee, and ice cream, but even removing all of these triggers didn't resolve the underlying cause.
I've been a heavy drinker of tea for at least the last 12 years if not longer. Black and Jasmine green are my favorites. I finally relented and tried switching off of tea for awhile. The problems cleared up.
In my research, there were two things that have the potential to cause this:
There doesn't seem to be any research conclusively connecting either of these directly to gagging. Excessive flouride would seem to have a different health symptoms that should have shown up, so my current best bet is Tannins.
Since this discovery, I have done more experimentation to try and prove it out. Sure enough, Black tea, with the highest tannins levels, triggers gagging the easiest the next few days. Green tea isn't as bad (lower tannins). I've also started cold-brewing my black tea as that also reduces tannins levels significantly while still enjoying my tea. I've also started drinking more coffee since tannin levels in coffee are about 10x less. While coffee with cream triggered issues before I switched off hot black tea, it no longer causes me any issue. Everything I've done points to tannins. Hopefully scientists will do some more research on them to determine why they might cause this.