To say that this riddle is hard because of ingrained gender stereotypes is only half the story. I find it hard and there are several doctors in my family. All of them are women. I have dated more than one (female) trainee doctor.

The riddle also functions on the level of word choice, much like Stupid human tricks such as Ask them to say 'silk'. Ask them to spell 'silk'. Ask them to say 'silk' three times. Ask them "What do cows drink?" .

Look at the words in the sentence "I can't operate on this boy, he is my son." We are being subconsciously cued into expecting a male.

Try this riddle out but change the gender of the child. Use "I can't operate on this girl, she is my daughter", which should in theory introduce no additional expectation about the doctor's gender. It will however be much easier to work out. Or make it neutral, "I can't operate on this kid; this is my child".