The point is that you are supposed to struggle with the answer because you can't imagine the doctor to be the boy's mother. That there exists an assumption that people will find this difficult to answer suggests that there is some sort of expected cultural bias about doctors being male or female.
An anecodte, of course- literally.
My sister is rarely at a loss for words but I'm not sure _she_ even knew what to say to that.
Sometimes a similar trick anecdote is told about a "German". There's a suspicion that the ending "man" in "German" primes the listener to imagine a man.