Sounds like they were gifts from other students. If that was the case, then I don't think it was the teacher's job to not give them to your child nor to filter them out.
Our school has a healthy treat policy for birthday policies--but they tend to relax on holiday parties. For the record, there are only two--Christmas/Winter/Etc. and end of the year. The school does, in my opinion, a really good job at encouraging healthful lunches (dessert 1x/week, fresh fruit all other times, plenty of fresh veggies, salads, etc.) I guess for me, it's not a big deal. The kids know that I basically take all of the candy they come home with--and then I decide when/if they get to have some. They're used to me checking things making sure that they're halal (we're Muslim--so most gelatin/gummy things are out for us).
Do you talk to your kids about healthful eating? I have to say, I'm surprised at how self-regulating my own kids want to be (7 and 5). They'll say stuff like, "we shouldn't eat too much candy because it's not healthy"... or "fruit is a better treat", etc. Maybe when these things do come home, it's a good opportunity to talk about why or why not we don't eat this (or eat this every day), etc. Another option would be to have some sort of exchange thing they can do. It could be food related... you know, Mom doesn't like all the artificial food colors because I don't think they're good for us, but why don't we put this aside and bake something together? Or why don't we go to the farmer's market and you can choose a special fruit treat for the family? I can't remember where I read it, but some Mom I know does something like this with her kids at Halloween. They leave their Halloween candy at a set location, and when they wake up there's a small toy or nice crayons or whatever in its place. I think she's Waldorf-inspired, so assume one of the candy fairies or something takes the candy. :)