This is the problem half the time. Nerds in childish t-shirts want to sit around pecking out code in isolation instead of taking full responsibility for their work by putting on a jacket and working the organization. This is why IT projects are consistently such disasters and why executives have the idea to get cheap grunts to do this stuff under a layer of middle managers.
The reason that programmers don't dress to impress is that their work product - the value that they add to other people - has nothing to do with their appearance. A programmer is paid for the software she creates; the user of that software has no idea what the programmer who wrote it looks like, and they judge the quality of it by what it does. So programmers have developed other metrics that they use to form a status hierarchy, notably the quality and difficulty of programs that you've written, but also things that are somewhat fuzzier like the technologies and tools you use.
Contrast this with a lawyer or salesman, where your buying decisions are directly influenced by how they present themselves and you often cannot directly determine the quality of their product. People in these professions have a strong incentive to present themselves well because customers have no other information to base their purchasing decisions on.
Certainly in the one metric shared across all professions - money - engineers at top tech companies are not being taken advantage of by management, nor are they "cheap grunts". A senior Google engineer makes more than all than about 2 of the salaries listed on the first page of a GlassDoor CEO search [1].
[1] http://www.glassdoor.com/Salaries/ceo-salary-SRCH_KO0,3.htm
That's completely irrelevant. The point is not whether Google engineers make enough money to be comfortable, or an amount that other people would consider "a lot", or anything like that. The point is that "all" the relevant big tech companies in SV colluded, prisoner's dilemma style, to pay them less than they would have if there were no collusion.
What good does it do anyone aside from the schmoozer and the schmoozee that some middle manager at Apple is good as schmoozing?
Doctors/lawyers interact with clients/patients a lot, so they dress to impress; whereas programmers only interact with other programmers or managers, who don't really care. If you're a programmer, the code you write matters much more than the human interaction around it (arguably the same can be said about doctors and lawyers, but a lot of people wouldn't hire a lawyer dressed in jeans and a t-shirt).
Also, there are external dress requirements. For example, a lawyer might get thrown out of court if he/she shows up in casual clothes.