There's a bit of a problem with this.
How can they possibly "learn to accept them", without receiving them to get them accustomed?

Seems rather like a catch 22.
Dogs nuzzle each other and rub up against each other as part of natural bonding. They do the same to us, mine are always rubbing their sides round my legs.
They also like to rub the corner of their mouth on family & friends, to impart their scent.
I don't see how hugging is all that much different. If you put your face into your dog's ruff, it's really quite similar to their natural way of showing affection.
Only if a dog feels trapped by the arms around them, could I see it having a problem with being hugged.
But, if the owner is pack-leader (as they should be), the dog will accept it, even if not entirely happy about it.
If they trust you (as they should), then they know that you mean them no harm, so there is no threat.
They didn't exactly have to "learn to accept" pats on the head, or stroking.