I think the teacher was probably being helpful, though there's a slight concern that the school has conflated 'grooming' with uniform and the rules are straying into territory associated with neatness and cleanliness and calling it a dimension of presentation expected at school.
Rules on uniform, nail varnish etc, should always be objective and never have the capacity to be censoring or penalising someone for the individual nature-given appearance.
There are always threads on MN where a poster has taken issue with a personal comment or lack of it. A poster was upset that people praise her sister's blue eyes but not her own brown ones; comments about a poster's size by their partner often cause hurt. We have to accept that any personal 'criticism' has the power to hurt - for adults as well as children.
Re appropriateness of personal comment, I would define professionalism as sticking to the job role. Part of that is not to get personal. If in a queue in TKMaxx with a three-year-old tugging and touching I would expect the cashier to say 'I will see if we can open another till for you'. I wouldn't expect them to say : " You know what, you shouldn't come shopping with your child'. If I was dropping carrots on the floor of the greengrocer as I packed my basket, I would expect the owner to say:" Shall I help you? Putting the boxes at the bottom makes it easier". Not to say, "Gosh, you're cack-handed'.
I think being distant and non-personal sets a useful model for children of how to behave to others in the workplace. For a teacher, and this one is probably very kind and trying to help, being personal in their comments is a recipe for disaster, as a retired teacher posting has said. It's best to act as if you don't notice the personal appearance of children. If you later need to comment on some unacceptable aspect of their behaviour, it will be clearer to everybody that you are not biased; you are not against this child personally, and you are thinking of how the behaviour affects the running of the lesson and not about their individual characteristics and personality.
I'm sure the teacher meant well, but best to forebear making any personal comments, in future.