I have heard this riddle mentioned as an example of how one’s visualization of a scenario affects logical reasoning.
The idea is that when you hear a word like “surgeon” or “doctor” you immediately get some kind of picture in your mind. Even if a person is VERY aware that doctors can be any gender, the archetypal surgeon or doctor that is called up in this picture will have a specific gender, since that is how most of us visualize things. Given the choice, then, the immediate mental picture of “surgeon” or “doctor” is more likely to be male (and wearing a white coat, etc).
Once you have this picture in your mind, and you are proceeding through the story, it’s hard to let go of the picture in order to solve the riddle.
According to this theory, it would make sense that it would be much easier to come up with the “two dads” solution, since you wouldn’t need to let go of your mental image.
Maybe related to some of this things discussed in this thread Before opening this thread, close your eyes and what do you see?
Edited to add:
It’s possible that modern kids who are surrounded by gender fluid or non binary peers might spontaneously visualize an archetypal “surgeon” or “doctor” without a specific gender. But for most of us, it’s natural for a mental picture of a human being to be either male or female. The mind picks one and goes with it. That’s supposedly how the riddle works.