Anecdotally, there was a particular incident when I was 6 and specifically didn't open the door for a stranger because my parents told me not to. It turns out it was the postman.
But regardless, surely telling a 5 year old not to take candy from a stranger no matter the stranger's reasoning is better than not doing so.
When I was 6, my mother and I accepted a ride home from the park. I was very reluctant. I told my mother that she might not know, but I had learned in school that one should not accept rides from strangers.
An interesting blog post by Razib Khan, who many here probably know from his Gene Expression blog, the old gnxp site or perhaps from his BHTV debate with Eliezer.
I recommend following the link and reading the rest of it there, not only does interestingness continue, the comment section there is usually worth reading since he vigorously moderates it.