There is no doubt in my mind that creatures tell and retain their story.
We have a pear tree in our garden. We are lucky to get half a dozen pears from it.
Last year, on a Saturday, the tree was covered in pears. We noticed a bunch of tiny bird visitors. I kid you not, on Sunday afternoon there was not one pear on the tree, (and none of them was texting. I checked!) and all the rotting pears lying underneath were gone.
So it's not beyond the realm of reason for a fully-fledged butterfly to have memories of the caterpillar stage. Nature's way of protecting them