The same thing happens with rodents. They gave lady rodents a lemon smell (citruis isn’t pleasant for them) and it caused them to have a kink for lemon smell for like 3 generations. Crazy stuff.
As for an explanation, Epigenetics is where you want to look. Its a fairly new field, few dozen years old, and it studies methylation of DNA. Methylation (addition of a methyl group to the exposed end of DNA) or demethylation (removal of a methyl group) happens in response to experiences while alive, and changes how genes are expressed. Doesn't change the DNA itself, but because the methyl groups are chemically bonded to the DNA some of them carry through the reproductive process. This means some of those changes are passed down. The epigenome isnt passed down completely, about half-2/3 of it is reset between generations, iirc, but what is passed down can cause stuff like this “inherited memory”.
The epigenome is really neat, and as far as we know, everything with DNA has one. In humans, for just one example tjat we know of, it can impact fat storage. If a person lives through starvation conditions, the bodies of their offspring will prefer to pack on weight because they think they are being born into famine. When researchers studied descendants of major famines (starting with those born during the famine), they found that those methylation points didn't reset for 3-4 generations. Thats insane! Thats a hundred years! Its also why as identical twins age, they can start to look more and more different, and they -can- actually be DNA matched if you have the tools to look at the epigenome, because no two adults will have the same lived experiences.

My favorite part is the installers.
I just installed a 2004 sierra game (Arcanum - very hard solo, def made for co-op) and the installer threw me back to the early noughties, and it was just lovely. That green progress bar and the wildly outdated game ads were hugely pleasing.