Well, it wasn't just the school handing out random colours (that happen to be highly gendered), it was ALSO the school/teacher/whoever telling the girls they can't have the thing the boys got. Like girls asking to wear the same clothes as boys (trousers) but being told no (as happens in many schools).
Yes I do think these little things like colours can be harmful when added up with all the other little things. On all the recent trans threads lots of people keep saying 'but a boy who likes pink is just that, a boy who likes pink. Liking pink doesn't make him a girl/trans.' And yet very many posters think it is a non-issue to say to a child 'pink is for girls' (as happened in the situation described by the OP). So take a boy child who really, really likes pink, but constantly gets told he can't have pink, that pink is for girls, that only girls can like/can have pink. What other conclusion can he draw than 'I guess I am really a girl?' - possibly after a lengthy period of trying to fit in, trying to not like pink, suppressing his genuine likes and dislikes, because they are somehow wrong. And ending up pretty confused.
It hasn't gone that far, but my DS' favourite colours were pink and purple. Up until reception summer term. E.g. he would rather have no new bike than one that wasn't bright pink like his old one.
He had quite a lot of comments from his peers, but we dealt with that with some pre-prepared phrases such as 'colours are for everyone'.
He also experienced that teachers divided the children into blue and pink groups (yes, divided by gender) and he had to go with blue. Had to make blue cards rather than pink ones etc.
At some point in summer term he decided from one day to the other that he hates pink and purple, and that pink and purple are for girls. Since then he refuses even to drink from a pink cup.
Except if he thinks no-one is watching.
I think he has genuinely found a new favourite colour, but I also believe he does not actually hate pink and purple, that he actually still quite likes those colours, but he would never admit it. I hate that he feels the need to suppress his genuine likes. We keep on passing on the message that colours are for everyone, so I don't think our child is in danger of becoming confused regarding his identity, but other children may not have that support. And I hate that it is such an uphill battle, with 98% of the messages he gets being that pink is for girls.