That is a reasonable thing to do. Dogs like people get allowances within reason for having unique failure modes. We all have them.
Telling people they're not welcome to pet the dog isn't an allowance, it's management.
Making allowances, to me, would mean simply permitting a behavior you otherwise wouldn't, and actually allowing the dog to practice the behavior instead of managing the environment to prevent the behavior. People who simply do nothing about a small dog who snaps, growls, bites because 'he's harmless, he couldn't hurt anyone if he wanted to', for example, I would say are 'making allowances'.
My point is the owner is not in control of whether someone suddenly pets the dog, and it bites them.
So the warning before, is also the allowance after. Depending on circumstances the owner can only partially control.
If the warning were not also a reasonable allowance after a bad incident of the kind the owner imagines is possible, then instead of a warning the owner should be avoiding any possibility of the situation.
I don't take her to dog parks or places with lots of people. Avoiding any possibility of the situation would mean not taking her for daily walks around the neighborhood; this is just the reaction when somebody who is not familiar in the neighborhood sees her for the first time (often people just walking down their driveways toward me). I don't think that fully isolating her from ever seeing a person she doesn't know is necessarily the best choice for her either.
For somebody to suddenly pet her, there would have to be a person who is hiding behind a hedge or car waiting to jump out and pet a strange dog, which would be a bad idea regardless of the dog's disposition to strangers.
I understand your point, but I think you're making the assumption that I'm putting her into avoidable situations that are higher risk, rather than the bare minimum necessary proximity to people in order for her to get her exercise and the psychological necessity for anxious dogs to scope out their surroundings regularly.
A dog who doesn't like to be touched by random strangers is not a bad dog, and strangers are not entitled to touch her! I'm 100% with you on this one. Many people seem to think that all dogs should actively enjoy all kinds of invasions to their personal space (that they themselves would never tolerate), and it's ridiculous.
You're also not, in my opinion based on this description, ‘making allowances’ for any unacceptable behavior. You're just keeping your dog (and people around her) safe and comfortable, despite the misplaced sense of entitlement of some strangers.