I can't find this TOS reference to acetylcholine, but if it's in there, they made the mistake of using a real neurotransmitter with known properties. A quick look at Wikipedia says it doesn't work that way, although one of the effects of nicotine is to selectively mimic the effect at particular receptors.
This isn't the TNG clip I was looking for, but it does feature Wesley Crusher having never heard of addictive drugs and failing to understand the concept. There's another clip I think from the same episode that features some senior staff being similarly unaware?
From the perspective of the 24th Century, all of these things can be (and are) synthesized, and their physiological effects seem to be thoroughly understood, so the difference between "natural" drugs like caffeine and fully synthetic compounds is moot (and that acetylcholine that wouldn't work is naturally biologically produced anyway.) If Picard's tea has caffeine in it, which (given it's coming from a replicator) isn't actually clear, then the distinction between that and a shot from the doctor is kind of a moot point too so long as its use is left to personal discretion. It's a false distinction. What's inconsistent is that caffeine is addictive and the 24th Century seems nonetheless unaware of the existence of addiction. For TNG by itself, one would take the impression that Picard's tea probably doesn't contain any caffeine at all.
This is of course inconsistent with Deep Space Nine and Voyager, where the coffee is explicitly caffeinated. But for all that people rail about nuTrek not following the TNG ethos, TNG is really the odd one out, and it's not just about caffeine. TNG elevates and distances the society that the Federation represents in ways that are unique to TNG. Janeway needs her coffee because it makes her relatable, nothing more complicated than that. Considering all the weird 80s-90s hangups the TNG crew do have, often in relation to gender roles, all the effort to make them feel like a real future society can feel a little baffling to me watching it now.
And of course, every series makes an exception for alcohol.
The trouble is that abject horror at the concept of street drugs in contemporary culture has largely been a tool of people in power to brand disadvantaged groups as less-than, which is why we've so long banned cannabis while permitting the more dangerous tobacco. And whether people addicted to drugs are blamed or pitied (TNG has some of both) they tend to be poor, disenfranchised, or politically malcontent sections of the population. There's a feeling of superiority there that reeks of class distinction, like the culture of the 24th Century is the culture of our 1%. Wine is fine, whiskey is frisky, beer ain't here.
From a purely speculative point of view, the biotechnology of Star Trek is such that
any positive effect people associate with any contemporary drug (in the broad sense including caffeine etc.) could easily be synthesized with no side effects whatsoever.
Or, drugs could be freely indulged and the ill effects reversed. Star Trek has always chosen not to include tobacco in the culture of the 23rd-24th C., specifically because it's been on the right side of history with respect to the effects and cultural perception of that drug. But take something that Trek chooses to make easy, like a simple injection that can save a person from fatal radiation poisoning, and you could fix lung cancer or other disease by much the same means. The absence of tobacco isn't about the speculative future, it's always been about the present.
In reality, quite a
lot of problems people still have in the 24th Century could be instantly solved with technology, and often the reason they still have them anyway is so that the show can have a story. Or even for staging concerns - Dr. Bashir doesn't send Sisko an e-mail with a bunch of attachments, he walks into his office with an armload of PADDs representing each individual report document. People in Star Trek don't spend their days sitting and staring at computer monitors, and in the rare unavoidable case that they do sit down at one, nuTrek makes it transparent so the cameras don't have to shoot around it.
Any bit of contemporary human culture that Trek chooses to include in the 23rd, 24th, or 25th Century is at least as much a choice about what that thing represents to viewers in the present audience as it is about any speculative aspect of the show, and what you choose to include or exclude and what you overlook in either direction says more about the present than it does about any hypothetical future.
Coffee and tea are just one of the easy ways available to the writers to ground the characters in
something that the viewers have some experience with.