How does it make thermodynamic sense for photosynthesizers to turn CO₂ into O₂?
Oxygen in photosynthesis does not come from carbon dioxide. It comes from water and this is the step that actually requires light: Photolysis of water. 
The proton produced in this process is used to synthesize ATP and NADPH by a chemiosmotic process similar to what happens in mitochondria. 
These biochemical pathways are also referred to as Light reactions.

Carbon fixation (or Calvin-Benson Cycle) requires energy (in the from of NADPH) and is therefore dependent on light reactions. The light has no direct role in carbon fixation. Oxygen production also, is not directly coupled to carbon dioxide consumption.