"Please don't pet him, he's uncomfortable with strangers" is NOT A CHALLENGE
I have a rescue pyrenees that was a stray as a puppy. I adopted him at seven months old and he's now four. He's the sweetest, cuddliest dog and loves and watches over my kids. He raised our cat from kittenhood like he was her dad (I have so many adorable photos). He never met a dog he didn't like. When guests come over to our house he's very interested in making friends once I've welcomed them in.
But he is very uncomfortable with strangers petting him on walks. He will jump backwards, then jump all over the place, barking his big booming bark. I do worry what might happen if someone pushed him way over threshold, mostly just because I had a bad experience in the past with a different dog of mine and now I have a "you never really know" perspective.
My general approach is to bring high value treats in my bag, give him verbal reassurance as we pass by people, and then reward him with the treat for being calm. If someone asks to pet him, I tell them he is uncomfortable with strangers and needs his space.
I swear it's about 60% of the time, definitely more than half, that people just go "Challenge accepted!" and start going on and on and on about how all dogs on earth just love them while pawing wildly at my poor dog. He cowers and barks and gives them all the warnings and they're just... Idiots. And selfish. And they objectify animals like validating and entertaining them specifically is a dog's only purpose in life. I don't even consider myself a particularly "omg I live and breathe dogs" person by today's standards, but this total disrespect for his boundaries just bugs the living crap out of me.
I got him a "Nervous, please give me space" cover for his leash, and some people act like I'm wildly irresponsible like I've brought a rabid grizzly bear out in public. And it's not even like that, he just doesn't like being felt up by strangers. Why don't dogs have any right to decide who touches them?
I mean Jesus Christ fuck off.