You'll be happy to know that what you describe exists and it has a name: pyrolysis. Pyrolysis is the thermal anaerobic decomposition of biomass. Basically, you heat up organic material without oxygen at temperatures attainable from a relatively small fire. During this process, volatiles such as hydrogen and oxygen separate from the carbon in the biomass feedstock (dry untreated wood, bones, old cotton tshirts, whatever) and get released as syngas, leaving more or less pure fixed carbon that is very stable, safely sequestered in soil for thousands of years.
The resulting carbon, called biochar, can be co-composted to prepare it for use in soil, where it protects the soil from drought and flood alike. Plants grown in soil with higher carbon content are bigger and healthier, and these soils can produce more of whatever you're growing.
I make biochar at home but there are companies that do it on an industrial scale.
Humanity has been pumping CO2 into the atmosphere at an epic scale for decades. In addition to going carbon neutral with more wind, solar and nuclear, we need to draw CO2 back out of the atmosphere on an epic scale. And biochar resulting from pyrolysis is one of the major tools since it has synergistic effects with other tools, like mass tree plantings. Biochar production can also offset other energy uses, for example by either directly burning the syngas on-site for heating purposes, or for capturing it and using it later as a fuel in an application that would otherwise use fossil fuel.