There is a type of beetle, for example, that will grow a horn for fending off birds at birth if its mother was attacked by a bird, but not grow it if their mother wasn't attacked.
That is, it's something innate that it's born with, but it's not genetic.
I'm not aware of this particular case, but the term epigenetic is what describes this. Insofar as how genes express actual physical characteristics (it's rarely a simple 1:1 match), there are also chemical (or even more complex) influences in the maternal cytoplasm (of various kinds) that might inhibit or activate genes that would otherwise have expressed themselves or remained dormant.
Genes play a smaller role than previously imagined in how children develop than originally assumed.
Well, you still
need the genes. Cut out the "gene that would create a bird-fending-off-horn" (or, more likely, sabotage the set of genes involved in such a subtle way that what is left does not also lose the more basic function of creating the exoskeleton, etc) in a gene-line and no matter how much "bird-stress" hormone the mother passes into the offspring's cellular fluid at conception the horn thing won't happen. (By definition, I know. I've constructed that example rather sloppily.)
The classic
human example (which is arguaed about by some, but last I saw was generally accepted) comes from the study of some people living in a Scandinavian locale, where those people whose mother's
mothers had been in a (well documented) famine that struck the area could be seen to have come out with a statistically significant different physiology from those that had not. The idea is (or was, and may have been revised) that when the grandmothers were under starvation stresses, the children (the mothers) that were conceived had direct epigenetic differences which may have helped
them deal with famine, but also influenced how
their ovaries (and thus the eggs that would become the
next generation, every one of them created in an immature form even whilst the mother-to-be was still in vivo herself[1]) formed.
The mechanism is one thing, the reasoning is another. In the case of starvation-stresses, sub-populations that had a tendency to create starvation-tolerant offspring (and offspring of offspring) are probably a good thing where there's little population movement in a land where long-term climate drift is sending the land productivity downwards. As is the tendency (delayed by a generation or two) to turn
off any unnecessary (and possibly disadvantaging) famine-protection when you've got some historical precedence tending to show that your offspring's offspring aren't going to so readily experience those conditions.
It's not Lamarkism, of course. "The parent stretches their neck, thus their offspring are born with longer necks." It's
possible that there could have developed a variable neck-length giraffe (a single expressed phenotype for each animal, of course, but a genotype capable of creating long
or short necks, according to which epigenetic cues get picked up from conception), where the capability to eat higher up trees gets keyed into offspring (or beyond) when the potential parent is subjected to less ground-fodder, but when there's a string of lush seasons[2] the shorter necked (and legged[3]!) versions arise to take advantage of the long-term fluctuations concerned.
Anyhow... There's also been talk in here that (effectively) is about how some creatures are strange for not have our XX/XY gender differentiation. Well, that's mammals (most mammals... there's
some populations with a missing Y, a sort of advanced notice of the 'predicted' loss of the Y-chromosome from humanity, at some multi-millennia point in our
own futures...), but go to birds and its W and Z chromosomes (and, IIRC, the "two alike" solution creates the males and the WZ-combo creates females). And birds aren't actually too far from us, really. (I can't recall what reptiles do[4]... Although I know they're capable of (ritual-less!) parthenogenesis. Especially monitor lizards. Useful when a lone female drifts from one island to another and has no other breeding option but to create 'fatherless' sons, who may be the only mates she will ever be able to have, but the sons then are capable of "mating with momma" and the brood that arises is mixed sex.)
There's loads of alternate reproductions possible, I suppose is what I'm saying (although when I started this post it was only supposed to be to say "It's called 'epigenetic'!", and leave it at that). And almost everything you might imagine. And many that you
can't imagine, or may not have ever imagined if you hadn't heard about it, like the male Angler Fish that semi-symbiotically clamps itself to the much larger female to sustain itself on her blood, or the stages of developments of some parasitical creatures that
must go through the systems of prey and predator, even to the extent of affecting the prey's behaviour to that they are more
likely to be predated-upon).
How (or
if) this could emerge in [RAW]-defined creature castes, I don't know. I am similarly ignorant of whether Toady is inclined to add spores that would tell a dwarf to stand on the highest part of the fortress until the resulting fungus has consumed the dwarf's innards and sprouted a fruiting body from which more dangerous dwarf-zombiefying spores arise.
It'd be a true-to-life (if scaled-up) method of reproduction. Some might say actually
too fantastic for a Fantasy World Simulator. Although possibly the biggest objection is that we already have more than enough ways to kill a dwarf, even if in adding this we were able to bring forth an intriguingly fabulous new life-form into the woldgen.
(If you're looking for a TL;DR;, there isn't one. Never mind...)[1] Ok, so it's not as far gone as Tribbles (and
some rare, but actual, earthly creatures), which are born
pregnant, but it's amazing to think of this. While men are more immediate and short-term in their genetic-material-packaging methods. Add that to the XKCD clip given, and life is indeed wondrous.
[2] Which would have to be on a longer cycle than year-to-year, to be of any particular use, or else get keyed to a frequency of change that is resonant with the time needed to breed each generation, perhaps something cicada-like melded to El Nino.
[3] I think it's said, by some, that giraffes necks aren't long, so much as it is their legs. Their neck is
barely long enough to allow them to reach the ground (even with legs splayed somewhat) in order to drink. Thus the neck isn't as long as it is in order to reach the high branches but instead (given that the legs have grown long enough to enable the giraffe to have a better chance of getting close to high branches) it's had to grow longer in order to be able to
reach the ground again. Of course, it's nothing like as simple a Just-So Story as that, even, and it's all interlinked in a whole accidental combination (which included accidental, but necessary and thus universally surviving, changes to the vascular system to handle blood-flow pumped up to a raised head while not over-pressurising a
lowered one) that one could not have predicted and yet can 'read backwards' from to gain at least some understanding of why "this particular solution worked".
[4] Actually, in describing this, I remember some of this.
Where chromosomes are key[5], demales are something like (assuming they share the same 'letters' as birds) WZ. Pathenogenically-produced eggs rearrange these to come out as WW and ZZ eggs only. One of these types is sterile, the other produces males. Those males, when they breed with a female (yes, possibly their own mother) do the usual "give half to add to half of the mother's set" job, but instead of it being which of the
male pairing, dictating the offspring's gender, it's which half of the
female gene that does this.
[5] And then there are those where chromosomes mean little, and it's the temperature of the nest that dictates the gender. Or every fish starts off male but social pressures send a precious few down the developmental path (in the wild, post-birth!) to become female.
Other fish start off all-female and (different) social pressures sends the 'top dog' fish into a conversion phase to make them
male. Like a mature-stage epigenetic influence, I suppose one could say (although doubtless there are better ways to describe this).