Putting mine into a middle position would set up a resource guarding opportunity (mainly guarding of the expected treat, but also of me) and would guarantee to make things worse. Shouting would also make things worse - he'd pick up on it, decide there was a genuine threat, and defend me from the nearest thing.
If he starts looking uncomfortable, we walk away. It's helped him to learn walking away as a form of de-escalation (he used to escalate any minor disagreement), and I think he probably feels like I've got his back and will help him get out of uncomfortable situations.
On occasions he has snapped at other dogs who are being obnoxious. As far as I'm concerned, it's all a normal part of dog life - one setting a boundary, and another learning not to be so bloody rude as a result. Humans do the exact same thing with children! Occasionally he's been snapped at too - "well you deserved that" has been my reaction in 95% of cases (and in the other 5% of cases "well I see this wasn't a match made in heaven, let's move on")
Mine does have a breed he hates with a passion. If I spot one I pop him on lead, and if the other dog looks like it might approach, I call out something like "sorry, I'm afraid my dog really hates [breed]", and if they seem not to get the hint "so it would be great if you could keep yours away from mine" and occasionally "yes I'm sure yours is lovely, mine is a twat". Can't remember it ever failing. Clear communication is enormously helpful.
(Side note on the topic of dogs on leads; a few days ago my dog and another dog were both off lead and greeting each other perfectly politely. I saw a man with an on lead dog walking directly towards us - no attempt to slow down, detour or otherwise avoid us, which would have been easily achievable as we were on a path in a field. I assumed his dog just had shit recall and he was happy with a greeting. He got about a metre from mine, who was starting to approach for a polite bum sniff, then hauls his dog up by the neck and announces that his isn't good with other dogs... FFS! Context is everything, and if your dog is crap with other dogs then don't actively set up greetings with others!)