This skill is important for all dogs. If the dog is being walked in the neighborhood or there are visitors in the home, the dog will encounter new people and should know how to handle himself around them.
When I was a kid my best friend, April, had a chihuahua named "Spunky." April and I were wrestling around on the floor, tickling each other. We both knew it was a game, but Spunky thought I was attacking April. So he bit me. If he had been more trusting of strangers he might have been able to see April was laughing and having fun instead of assuming she was being attacked.
Fortunately for me, Spunky was old and had no teeth. It could have been very dangerous if Spunky had been larger or if he had teeth. Even very small dogs can hurt someone badly enough to cause them to go to the emergency room.
It is important to teach your dog to be polite and confident when meeting new people. It is just as important to always ask before petting someone else's dog, even if it appears friendly.