Yes, and sometimes we instead leave obsolete technology in place as a living museum.
Again, surely a compromise could be found -- replace, say, 98% of the gas lamps, but leave 2% functioning in a special historic district.
With smart leadership and marketing, such historic areas can drive considerable tourist and economic activity as well.