Some dress codes can be too much restrictive, useless and even sexist, I guess what you mean and I can also agree, but my reference was certainly not so 'extreme'.I'm a complete rebel where that is concerned - I really don't care what people wear or where they choose to wear it. There are lots of 'dress codes' which are not only restrictive and possibly pointless but also sexist. Safety, is another matter of course and dress codes are important in that context.
Personally, I wouldn't go out into the street wearing pyjamas (not that I possess any!) but there are plenty of women in my street who do.
An easy example, referring to what @TastyReuben has written about the office dresscode: shorts (worn by both men and women) or flip flops in the office (especially during the 'casual Friday'), I would say no. There is a respect for certain shared places that must be respected, even if is the casual Friday.
Going out on the street wearing pyjamas.....gosh!