Power, Sex, Suicide by Nick Lane (2006) part 5 "Murder or suicide" mentions that the key events that leads to apoptosis is when certain proteints normally present in the inner mitochondrial membrane spill out, and that this often happens when free radicals are produced in excess: the cell is really not doing well in those cases. This point suggests that the initial mitochondrial endosymbiosis happened due to a parasite that lived inside another cell. It mentions that even today we see parasites kill the host cell when they feel that the cell does not have many nutrients. This frees the parasites to then infect other cells.
Exactly 1033 somatic cells on male, 959 on hermaphrodite, every time, counted as of 2020. A beauty.
Exactly 131 commit apoptosis in the hermaphrodite.
www.wormatlas.org/celllineages.html contains the full lineage as some huge and impossible to view images. This image was taken directly from The embryonic cell lineage of the nematode Caenorhabditis elegans where it is split across many pages, it is a thing of beauty on the PDF.
www.wormatlas.org/celllistsulston.htm contains a non-hierarchical table with the cells and their names.