It might make a lot of sense actually. It could serve to speed up instinctive responses to stimuli which have been encountered before, i.e. whipping your finger away from a hot surface.
I think I understand what you're getting at, but the example you gave is not a learned act, it's a reflex action. It bypasses your brain entirely, you generally recognize the pain after you reflexively withdraw your hand.
source: https://en.wikipedia.org/wiki/Withdrawal_reflex