This is part of the carbon cycle.
https://earthobservatory.nasa.gov/features/CarbonCycle https://www.fs.usda.gov/ccrc/topics/global-carbon
One factor that must be accounted for is the large amount of energy that ends up locked into fossilized life, basically a percentage of life is transformed into minerals and stone (Like seashells, petrified wood or limestone) and although the energy is still there it is in an unusable form at this point in time.