If the teacher does not actually know the person collecting a child, then he/she should have to produce photo ID. It's not that difficult these days when driving licenses, which most people have, include photographs. Mind you if this grandfather had such poor sight that he couldn't tell that the child given into his care wasn't his granddaughter, presumably he wouldn't be driving. Passport ID?
In any case, you would have thought the grandfather would have said something along the lines of "I have come to collect Jane Smith to take her to her doctor's appointment. I am her grandfather." That way, Jane Jones would have stayed at school.