For those comparing with employees not being reprimanded for removing a tie on the way home - the difference there is that employers are not deemed responsible for, or judged on, teaching their employees how to behave well, develop attitudes of respect etc.
Comparisons with lack of uniform in other countries are equally irrelevant. All countries I know of which have no uniform still have rules, and those rules must be respected e.g. no baseball caps. The issue is respecting a rule, not what the rule is (obviously, we are not talking about blind obedience to rules which cause great harm to people). Moreover, schools play a very different role in pupils' lives in many other countries: pastoral responsibility is vastly reduced and parents are responsible for ensuring children are fed, provided with school equipment including textbooks and stationery, do their homework etc. Whether everyone likes it or not, the fact is that in the UK schools have a responsibility in these areas.
A few people have said the school's job ends at the school gates. This is wrong (in England + Wales, probably Scotland + NI too but I'm not certain). DfE issue guidance on the school's responsibility beyond the school gates, and Ofsted teams commonly spend time in the area around a school before school starts and when it ends, to observe behaviour and attitude e.g. from 8am outside a secondary which starts at 8.40. Many schools in challenging areas deploy staff to supervise pupils beyond the school gates for e.g. 15 mins before and after school, but there is no rule saying that responsibility ends at a particular time after school ends. If a child goes home at 5 after a school club, for example, expectations are the same as if they'd left at 3.30. For practical purposes, many secondaries (whose pupils are much more likely to be without an adult) use the 'in uniform = representing us = comply with your school's standards of uniform/conduct etc' rule of thumb and pupils know this.
Personally, I dislike a lot of uniforms and a lot of uniform rules, but the overall impact of following these rules - rather than flouting them - is beneficial to the individual (no hassle) and the community (staff not having to nag, reduced friction between staff and pupils, no wasting time talking/reprimanding/ringing home etc etc about uniform instead of other things).