For the restaurants I worked in it we had to ask sometimes due to possible cross contamination issues for certain food.
One customer gave as a huge headache telling us that she was allergic to mayo, but the cook needed to know what part of the mayo she was allergic to because mayo is a mixture of things and several of those other things were ALSO in the item she wanted. Every time we went back to clarify she would get pissed and just say "I'm allergic to mayo, if you put it in I will sue you if I don't die from it." and still not tell us what PART of it was. Eventual the cook himself had to go out and explain in person that HE NEEDED TO KNOW WHAT PART IT WAS SHE WAS ALLERGIC TO OR HE COULD NOT MAKE IT, and she eventually admitted "Oh I just wanted to make sure you didn't add it because I hate mayo. You guys might put it on anyway unless I say I'm allergic." (I guess it's a commonly used 'life hack' to make sure restaurants don't put it on your food cause they want to avoid legal trouble)
In actuality... NO, he actually wouldn't have. That would result in food being returned and wasted, the meal being re-cooked and then money lost. It's a small family owned business they can't afford to play around with that shit. You could have just said 'no mayo' it's a really common request???? She didn't have to lie and say she had allergies and give everyone a hard time about it.
On the other hand my sister is allergic to milk, and when she asked for no cheese on a burger they put cheese on it, but instead of making a new one the scrapped it off, which resulted in her throat closing up and her being sent to the hospital. This was at a fast food restaurant, were I find most of the switcharoo's happen especially with diet versions of pop.