OK, but where are those carbon, sulfur, & phosphorus-containing compounds going to come from? This is just basic conservation of energy: if your bacteria are going to run the endothermic reaction that splits apart CO2, then they have to also be running some exothermic reaction(s) to get the energy. Your chemosynthetic bacteria are just using different reactions on compounds found in rocks.
As for the thermodynamics, you seem to have missed an important point, which is that you can't extract energy from something that's at a constant temperature. You need a temperature difference. Thermophile bacteria (the sort that live in hot springs & ocean vents) aren't extracting energy from the heat of their evironment, that's just where they live comfortably.
|