Because the energy expenditure is not supposed to halve when the rewards do. The premise of Nakamoto consensus is that the decisions are finalized if and only if the chain constantly has enough hash rate to outpace anybody that might want to rewrite it. If the hash rate were to every halve, the chain would be jeopardy.
The price of electricity, it's CO2 emissions per KWh and the future price of bitcoin is not in the source code.