Sometimes, we'll find that people will put a lot more energy into enforcing a rule than figuring out whether that rule actually makes sense in a given case.
And as we can see from example after example, you'd be hard pressed to find a rule that brings this attitude out in people quite as much as a dress code.
In some cases, we can see that even places that aren't subject to dress codes also aren't immune to this type of behavior. After all, what's considered inappropriate varies from person to person and some people are more aggressive about enforcing what they want to see than others.
But even with that in mind, one case of dress code-based rigidity comes across as ridiculous enough that it's a wonder anyone had a problem in the first place.