My experience as a teacher is only in FE, with over-16s and adults, but as a parent (and indeed grandparent) I do know some of the tensions that can arise in the parent-teacher-student relationship. I can only speak for the UK, but it seems to stem from the change in parenting fashions from 'discipline' to 'nurturing', the decline in social deference, the increase in the number of graduate parents, the instability of families and huge, anonymous schools.
There's a world of difference between a 'dress code' and a school uniform. A dress code will ban certain types of clothing, whereas uniform specifies what will be worn. Most senior (High) schools here require grey or black trousers or skirt (number of pleats and length specified, but almost all schools allow girls to wear trousers) and a blazer of a specific colour, with school badge on the breast pocket. White shirt or blouse, school tie and jumper or cardigan in specific colour. Black leather shoes, flat for girls, but they don't often go as far as specifying the style (none of the 'Oxfords, not Brogues' attitude-- though most kids shoes are Derbys, Monks or Loafers), what we call 'trainers', like Nikes etc aren't allowed. Only the most old-fashioned schools specify the type of top coat or any kind of headwear.
The idea being that if everyone is wearing the same, there's no competition about clothes and fashion and it avoids conflict between Chavs, Townies, Goths and Emos. However, most State schools have given into pressure by allowing the hijab and the patka to be worn, as well as allowing Sikh and Muslim teenage boys not to shave. This has unfortunately led to defeating the object of uniform by marking out these groups within schools and this making them targets.
Rather amusingly, when my son stopped shaving at fifteen, he was sent home to get a shave one day. I took him back, pointing out that several of the lads in his class, including some he was friends with, had quite respectable amounts of facial hair. I was told that these were Sikh or Muslim boys who were not allowed to shave because of thir culture and religion. So I pointed to my own beard and said "My son and I are of Viking descent, and in our culture, a man is required to have a beard as well! " Whereupon the Head Teacher, with whom I had crossed swords before, to his discomfiture, said "OK, but I draw the line at battleaxes! Rik's dangerous enough with his fists!"