Dress is usually about making the right impression - based on client/customer expectations. If I went to a solicitors office I'd want to see suits and ties but if I visited a web design firm then more casual dress would be fine.
You make an excellent point, one that I hadn't considered in those terms per se. I'd mroe though about how dress makes the right impression from the perspective of the one is getting dressed. That is that as an employee I am always thinking about the impression my clothing makes, the message that it sends. I never really thought about how I count on seeing a certain level of professional attire when I enter a particular environment, but it's absolutely true. When I go to someone for help, be it banker, lawyer, physician, etc, I do expect that the way they are dressed with reflect the level of professionalism and to a degree the level of competence.