I don't think this is about protecting children from the bad social influence of teachers--that's too absurd. I think it's about protecting teachers and their students from accusations of favoritism.
Even at the university level, where students in graduate courses may easily be older and have more advanced degrees than their teacher, it's just not appropriate for the teacher to hang out with one of his or her present-time students more than the teacher hangs out with other students in the same class. Rightly or wrongly, a teacher who spends more time around one student than others creates a perception that that student is getting some sort of special coaching, preference, or other privileges.
Teachers and students should be friends...after the student has finished the course and has no intentions of taking any further classes taught by that individual teacher.