I completely agree with you, but I've always thought of this problem via a thought experiment. Imagine I'm talking to a younger employee who either is fighting the way the world works, or doesn't quite understand it.
And so, I explain to him "Listen, even though it's unfair and irrational, people are going to judge you based on how you dress. If you want to get ahead at this job, dress and act as professionally as you can. This will help you, even if your skill at the job takes its original trajectory."
This is true-if-unfortunate advice. But, imagine its sort of inverse.
"Hello young employee. _I_ am one of those people who will only judge you as being competent if you dress professionally. So up until now, I've been disregarding your input because you're wearing the wrong uniform."
In the first example, we are helping people to not fight against human nature so much. In the second example, we are totally acquiescing to human nature! I think example #1 can lead to more of example #2, but in example #2, you the individual have a responsibility to rise above even if you know it will just be a drop in the bucket.
Isn't in some sense, depending on the in-group you pretend to fit into, change the "dress-code" you're supposed to follow.
Some companies might be strictier, but I don't think I've ever had my capacity as a dev put into question due to my clothes
The only places where that mattered, was in-office work where customers could come-in and thus see you, and still then it didnt matter much if you weren't on a customer-facing role
That brings me to what I think is the most interesting contrast between your examples. Both #1 and #2 require an awareness of group social dynamics, whereas #2 requires a degree of self-awareness on top that I've found to be rare (or at least rarely revealed)