I think you've gotten some great advice- so I don't have too much to add. But in our family I'd likely just try to keep the message simple. I probably would have said something along the lines of "when a stranger gives you a compliment, it is most polite to respond with a simple thank you." I've found that the more simple I keep it (no lengthy discussions of self-esteem or why his response was less than ideal) the more likely my literal kid is to get it right away and not start having an internal "was I bad?" dialogue with himself. YMMV.