Most industries that have "dress codes" don't actually formalize it either. There's nothing that forces lawyers to wear suits and ties other than a belief that you would look weird to other lawyers and the public if you didn't have one. That's exactly the same sort of force at play here.