It's kinda like purposely pressing your hand into a hot stove eye, its something psychological I think.
Fun fact : you're entirely right. If I remember right, it's tried with kids younger than 2 years old, you put your index against his palm, and normally, he'll close his hand around it. It's also why, if you suspect a fire on the other side of a door, you're told to touch the handle with the back of your hand (after patting the door itself to check if it's warm to the touch), since grabbing the handle properly will, in case it's actually hot, cause you to mechanically close your hand, burning it, which will, in the best case, only incapacitate you, since you usually use your main hand.