I think its fine. I don't have kids, but if I did, and they received a thank you from their teacher in the mail, I'd simply think it was nice that he/she took the time to write and send the card and acknowledge the gift.
I agree that giving them out in class isn't the best way; as others have pointed out, what if not every student gave the teacher a gift? I have to be honest, over the years, hearing about friends who have to buy teacher gifts etc. I don't ever recall giving my teachers any holiday gifts. Maybe the other kids did, and I didn't, or maybe it just wasn't done. I honestly don't remember. So if it were the case that my mom didn't provide me with any type of gift, and the other kids did give them, I'd feel pretty hurt if my teachers handed out thank yous to them in class.
Some of the other examples, given, no, not at all appropriate. But in this case, it was simply responding to something already done, not soliciting or trying to gather information from the students and their families.