The US continued to burn coal in powerplants just due to misaligned incentives, at a cost of tens of billions in energy costs alone (i.e. not counting pollution health effects or climate change), when gas and renewables were cheaper.
Similarly China, although building lots of solar/wind/batteries hasn't really had state of the art grid regulations for capacity planning and has local state governments sometimes working at cross purposes.
Both are in the process of shaking free of these historical mistakes, but your assumption of an instant reaction of perfectly responsive energy markets is mistaken.