This is just really rude behaviour on the part of other people and I would frankly be yelling at them to get their dog away and to have control over their dog, if they are unable to recall the dog. I would also choose a different direction as soon as I saw another dog coming, and make it very clear - by standing between my dog and the other - that I did not want them to meet. I wouldn't allow people to continue to do this, or they will see nothing wrong with it and nothing will get any better.... If it is socially difficult (due to human responses!) for dogs to run up to other dogs, hopefully it will occur less often. And for your dog, it's impossible to say what the cause is, but the more he experiences this behaviour from other dogs, the greater the risk of him developing issues with other dogs himself.