You are correct to a point. An old car has already effectively amortised its production footprint so from a total CO2 perspective driving an old car could be seen a relatively green in that sense. Which is possibly a good argument against scrappage schemes or the like.
But there is also the air quality and immediate emissions element where clearly driving an old car compared to an EV is not green at all and is polluting the near environment to anyone around it.
Finally you are comparing keeping a car for 40 years v renewing one every 5 years so itís not an equivalent comparison.