I don't remember when or where I read this. Not as far back as the 70's-80's, I think, but in the 90's or more recently I don't remember. Probably novella length, or very long novelette, but not a novel.
There were two main ideas in this story, both based on ancient thinking.
One was that one could "activate" lumps of clay using texts written on parchment : the classical legend of the "golem" of Judah Loew ben Bezalel in Prague. In this story, the more elaborate the text, the more diverse the actions the lump of clay could perform.
The other idea is also a very old one : every spermatozoon was a complete human being just waiting for an egg to have energy to grow, but containing in him all the elements of the future man, including his testicles and all his spermatozoa and hence all the future generations.
The logical conclusion of this notion was that, of course, since the amount of matter in a spermatozoon was finite, the number of generations should also be finite. Since along some lines, people have children when still young while other lines have children when older, it does not take the same number of centuries to reach the end of the number of generations for everyone. But people in the know realise that more and more lines were becoming extinct because they were at the end of their preprogrammed generations. The end of mankind was just a few more generations away, even for the longest surviving ones. It would be an apocalypse, not with a bang but with a whimper, but an apocalypse all the same.
Now I don't remember the exceedingly clever way the first idea (the "golem") was used to avoid this danger. But I know some guys managed to tie the two notions together and save the human race.
Kudos for the author, for I really don't remember how he (she ?) did it !
Now I saw that there was a question about animating clay, like a golem, but it was about two energy creatures. Here, these are just normal humans thinking of a clever way to save the human race, not of creatures with special powers.