This behavior best illustrates the concept of imprinting. This is a psychology concept that refers to learning that is sensitive to being acquired at a particular age or stage of life. This learning is fast and independent of the consequences that behavior can generate. It
is considered that the impression has a critical period to be acquired
(that is, it can only be acquired between a particular stage).
I hope this information can help you.