A recent article in Scientific American by Robert Martone explains some recent research on how fetal cells become integrated into mothers' brains for the long term: "Scientists Discover Children’s Cells Living in Mothers’ Brains"
In this new study, scientists observed that microchimeric cells are not only found circulating in the blood, they are also embedded in the brain. They examined the brains of deceased women for the presence of cells containing the male “Y” chromosome. They found such cells in more than 60 percent of the brains and in multiple brain regions. Since Alzheimer’s disease is more common in women who have had multiple pregnancies, they suspected that the number of fetal cells would be greater in women with AD compared to those who had no evidence for neurological disease. The results were precisely the opposite: there were fewer fetal-derived cells in women with Alzheimer’s. The reasons are unclear.
Sometimes people wonder what HLA is really for. Once in a while, having someone else's cells inside you isn't quite as harmless as the case discussed here. Being able to recognize your own cells may be your only means of defense.
The kind of microchimerism described here lasts throughout a woman's postreproductive lifespan. The strength of selection varies across this timeframe. It was logical to hypothesize that the cells might have negative side effects on fitness, such as Alzheimer's risk, that manifest late in life. Mothers must suppress their immune responses to some extent during pregnancy, to avoid health risks to the developing embryo and fetus. That suppression cannot be cost-free; if it were, we would expect everybody to tolerate human foreign bodies as well as expectant mothers. Having roaming stem cells integrate themselves into neural tissue must not be good on average; if it were, we would have cells crawling their way into our brains all the time.
I bet those cells worm their way into the brain so that your mother will love you better. The only thing wrong with that hypothesis is that it can't explain grandmas.