This is the fake emergency, and it works because a frightened child stops thinking. Their heart races, their brain goes into panic, and they follow whoever seems to be in charge. It doesn't matter how many times you've said "never go with strangers" if the stranger has just told them you're in the hospital.
The fix is a family password. Pick a silly word together, something only the two of you know. Then the rule is simple: if anyone, even someone who looks like a friend of the family, says you sent them, your child asks for the password. No password? No way. Kids love this rule because it makes them feel like a spy, and it turns a scary moment into a test they know how to pass.