Maybe, but he was killing monsters and resetting for a long time before you came to the underground. I'm sure one of them must have yelled it to him at some point.
*dying of blood loss* AH FLOWEY YA DICK. SPEAKING OF DIUCKS DID YOU KNOW THAT WHEN A DICK GOES IN A PUSSPUSS ITS A **** ? AND THATS HOW ASGORE AND TORIEL MADE YA. *dies*