If it were me, I wouldn't email the teacher, but just give a call. (I've found email to be very problematic in regard to problem-solving) You can just start the conversation with an acknowledgement of what was said "You know, the other day, when Sophia came home, she told me she was very upset. She said that you'd spoken to her in front of the entire class about her hairstyle being disruptive to the group and against policy, and so I'm looking to find out what happened, and to find some common ground on this."
I'm always willing to check in with a teacher if my son tells me something is bothering him. Sometimes kids don't absorb ALL that the teacher says, and only focus on the part that upset them, because that's what stays with them. Obviously, this was upsetting for your daughter, and it's also worthwhile to find out what else had been going on. Perhaps it was distracting from what the teacher was doing because the other girls were asking questions about it when they should have been paying attention to the teacher. (At this age, it's a possibility). While the distraction during classtime should have been addressed directly to the group--"Eyes forward, ladies! We can talk about Sophia's hair at recess.", the issue with the hair color itself should have been addressed to you via note or phone call, because the teacher has no way of knowing if you received the information or if your daughter would just forget it (conveniently or not!)
I think many classrooms/schools are also trying to find balance in allowing children and families some autonomy in dress and hairstyle while trying to maintain an atmosphere of learning. Admittedly, this has always been a challenge. Historically, girls at one point were barred from wearing pants to school, then jeans, then skirts had to be a certain length, etc. With all the different hairstyles, body piercings, inappropriate clothing, etc. it's very hard for the teachers and admin to find a solution everyone likes. Only relatively recently have I seen younger children so significantly altering their hair. If the teacher is anything like me-- 30 years ago, when I was your daughter's age, the most outrageous hairstyle I might have seen in class was the sideways ponytail or braids and barrettes on the African-American girls. Some people, teachers included, also have strong feelings about chemically processing a young child's hair. So trying to find a common ground and building a bridge with that teacher will be important, because you all have the next 5+ months together.
I hope it's a productive conversation.
H.