It's even sillier than that because "energy costs to produce energy" is a cycle.
Suppose it emits 80 tons of CO2 to produce a given amount of solar when 80% of the power to build the solar farm comes from coal. Okay, but now you have solar farms generating 15% of your energy, so the next one only takes 65 tons of CO2 for the same amount of solar. Pretty obvious what happens when you stop burning fossil fuels entirely.
Suppose it emits 80 tons of CO2 to produce a given amount of solar when 80% of the power to build the solar farm comes from coal. Okay, but now you have solar farms generating 15% of your energy, so the next one only takes 65 tons of CO2 for the same amount of solar. Pretty obvious what happens when you stop burning fossil fuels entirely.