And then add on top the environmental impact of all of the money that programmer gets from programming - travels around the world, buying large houses, ...
If you care about the environment, you should want AI's replacing humans at most jobs so that they can no longer afford traveling around the world and buying extravagant stuff.
"You'll be fine digging trenches, programmer", they said.
Seriously, though:
...so that they can no longer afford traveling around the world...
This is either a sarcasm I failed to parse, or pure technofascism.
Your reasoning could be effective if we bounded the computing resources usable by all AI in order to meet carbon reduction goals.
[0] https://en.wikipedia.org/wiki/Rebound_effect_(conservation)
The programmer will continue to exist as a consumer of those things even if they get replaced by AI in their job.