Another possible benefit of having vending machines? In theory (subject to being adapted to do so) the trolley could restock from a vending machine, with the machine more easily refilled (it transmits details of what it needs automatically, and there's no need to 'cash up' etc) at stations along the route, or at the terminus. Or, at least by having it there the passenger can use it directly.
Again, it means people have the option of using a vending machine but would more likely use the trolley if running for convenience. That vending machine offers the additional reassurance and confidence to wait and spend money onboard. I think that, cost aside (but station shops are rarely cheap), I'd always prefer to buy a coffee on the train at my convenience than have to buy it and other snacks in advance and carry it with bags to my seat/to find a seat.
There's a lot of interesting points here, I'll try to address them one by one.
Hot drink dispensers are a minefield, quite frankly. Not only do you have to ensure that they're well stocked, but they also need frequent cleaning - and not just for hygiene reasons. Those things clog up. Often. Not only that, but pouring boiling water at speed is very dangerous. That's why TOCs were slow to accept reusable cups until they were certain they were safe, and why many will only serve seated passengers from a trolley. For those that still have a bar, you'll be forced to put your drink in a bag to prevent it spilling on someone. I'll add that pretty much all catering staff have to be trained specifically in how to pour a hot drink safely. Given the amount of people I've seen insist they don't need a lid and/or bag, I'm going to say they're a non-starter.
That said, you're right to say that many people would rather wait for a trolley, but I know fine well that plenty will go to the bar in order to be served quicker or benefit from a wider range of stock (often hot food or chilled drinks).
The important point here is that some people can't, for whatever reason. I presume one way around this would be to place a machine in the accessible seating area, but that doesn't seem an acceptable compromise if you need to travel in that area.
While it's well known that people want the option of being able to buy something to eat or drink on the train, I suspect TOCs value the additional visible member of staff providing customer service on the train over the catering service. I can't see how a mending machine would offer an improved customer experience. They are pretty fiddly to use in my experience, let alone on a moving train - I don't imagine restocking one on the move would be much fun either. (I'd also be concerned as to what would happen if one tipped over. You'd need a machine or a restraint designed specifically for the type of train it's being used on).
Then there's the security aspect. I feel that something like a vending machine is more likely to be a target for vandalism, given that it's unattended and potentially filled with money. A large glass pane on the front will, sadly, be too inviting to some.
When it comes to public and trade union relations, I think vending machines would be a disaster. It would be perceived as a demonstration that train companies value money over passengers and customer service. If the train didn't have catering before, the machine would likely replace seats. If the train did have catering before, it would be replacing staff. There would be no winning the argument.
For what it's worth, I'm very much inclined to believe that a trolley service (at the very least) provides better return on investment for any TOC than an automatic vending machine.