How does an energy input actually change a molecule?
It is about transition energy barriers.

Imagine a mountainous landscape with lots of valleys of different depths. Stable molecules are large balls than sit in the bottoms of the valleys. Add some energy and the ball might rise up the valley floor but it will fall back. Add enough energy and the ball can rise high enough to get over the barrier to the next valley and will fall into a different place with a different depth (and the analogy falls down as it also becomes a different ball). So, whatever the relative depths of the valleys, there is a big barrier to getting from one valley to another. Even when one valley is much lower than another (so moving from one to another releases energy) you still have to put energy in to cause the transition.

Chemical reactions are often controlled by those transition barriers between one molecule and another rather than by the absolute energy difference between the molecules. Methane and oxygen will burn to give various compounds and will release energy, but there is a big barrier to starting the burning process. This means that the deoxygenation reactions you describe are possible and won't spontaneously reverse even though they would release energy if they did.