So I suppose the lesson here is that if it is uncomfortable to explain to strangers a sudden change of intentions, then don't.
Obviously, in this story, the urge to gift a coffee was tempered by the fear of being perceived as creepy. The agile fix was to change the target of largesse from a fellow patron to the worker. Kudos for that fleetness!
More difficult, but still kind, would have been to change the type of kindness. Sharing inner contemplations with those two people would also have been kind, but much more risky. Having more than superficial conversations with strangers is a gift. Many endure isolated lives bereft of profound interaction. The acknowledgment of another’s value as a worthy conversationalist is a kindness. This circumstance though called for a quickened wit which is developed exactly by taking such risks.
Perhaps one of these gems followed by “SoundS crazy, but let me explain…” would have broken the ice:
“I almost didn’t pay for your coffee today!”
“I don't let good manners get in the way of kindness!”
“What would you prefer? That I pay for your drink, leave our server a larger than usual tip, or do both?”