My granddaughter has always spontaneously hugged other children. If the other child or their parent seemed uncomfortable I would take my grandchild's hand and gently pull them away and say, we only hug people who want to be hugged. This seemed to take care of the situation.
My granddaughter, at nearly 10, hugs her friends. Every once in awhile I notice the other child just standing with their arms down and I quietly say to my granddaughter that so and so doesn't seem to want to be hug. Gradually my granddaughter is learning to recognize those cues.
Because we are a family that hugs I've not been concerned about actual hugging. But I have been aware that my grandchildren need to learn to recognize social cues. I didn't begin to expect my granddaughter to recognize when to hug and when not to until 2-3 years ago. I began having conversations with her about ways to show affection and when to recognize when someone is uncomfortable.
I was surprised to learn during a conversation with one of her friends that she didn't like to be hugged even when she was feeling good about being with her friends or even her parents. Even tho she didn't like to be hugged she never took offense and neither did her parents. I was also surprised that even when parents were present they didn't ask my granddaughter to not hug their child. I watched carefully and haven't picked up on much discomfort either. It seems that hugging in our group of acquaintances and friends is accepted even when not initiated.
I think that most parents realize that toddlers are spontaneous and are not concerned when another child hugs their child. A hug is not an "in their face" contact. At least I think of the term to be describing angry contact.
I also think that a hug is an acceptable way of greeting unless the other person is uncomfortable with it. I've learned to pick up on cues, mostly on an unconscious level. I expect that children will learn to know the difference between when to hug and when not to but it does take several years to develop that 6th sense. I wouldn't be concerned about your son hugging in greeting. Just monitor it and intervene when you think it's appropriate.
So, I agree with your way of thinking of this situation.