I think it’s those that started their career pre the year 2000 that have these “beliefs” about dress codes.
In my 20 years of working in law firms, attitudes have changed massively. What I wore in 2005 was so formal, by 2015 it had become far more casual, and then after lockdown things shifted massively as everyone had got used to seeing people dress more comfortably when working from home. If I had said I had seen lawyers wear hoodies and jeans to the office or on a video call to back in 2005, people would have thought I was mad.
The “no black suits/no brown shoes” brigade tend to be those who were “brought up” on the dress codes of 2005 or earlier.
I think there is also some classism on certain attitudes around dress codes. The idea you should wear certain things usually comes from those who have wealth that allows them to buy high quality clothing. Yes, clothing trends these days filter down to affordable fashion, but the principals of what determines “fashion” in more instances than not is driven by those with wealth or those making garments for people with wealth. This applies to work attire too. These attitudes are embedded at a young age as well - you only have to look at the more formal school uniforms for fee paying schools compared to state schools as an indicator of conservative and rigid expectations.
Fortunately, as the profession is becoming more diverse, so are attitudes to dress codes. Give it another 10 years and I suspect people will be laughing when they hear that people once said people shouldn’t wear black suits or brown shoes.
Edit: I’d also stress this is very much a “City of London” attitude. Outside of London, you don’t see the same attitudes.