You replace preemptively when the cost of a *required* replacement (i.e., after a failure) exceeds the cost of the preemptive maintenance.
They replaced all the gas lines (*to* each residence as well as the feeds throughout the subdivision) here in the past year or two. (i.e., "piecemeal").
The time involved was incredible! A single residence would take the better part of a day (the crews had to leave the property looking the same as when they arrived). So, there would be 6 or 8 crews working the neighborhood at a time. And, this went on for months!
When they (later) came through to replace the mains (and upgrade them in the process), they first "located" all of the buried services (phone, CATV, electric, water, sewer) in the roadway. Then, cut "spy holes" through the asphalt and excavated down to expose each such service, verify its presence and its depth below grade.
Then, they used a "horizontal drill" to burrow under the street while working to avoid each of these services whose path the drill would cross (from the time the service is exposed to the time it is reburied, it remains *their* liability). While the drill could run ~700 ft in a day, all the prep work and followup work made it more like 50 ft per day, overall -- by the time the spy holes were all filled in, pipe sleeve shaded, etc.
*Then*, they had to switch all those *new* residential "drops" over to the new feed and "abandon" the old feeder.I.e., this was a *huge* investment. Yet, everything was "working" at the time it was undertaken. Obviously, the concern was that a natural failure after several decades underground could easily cost them millions of dollars (if a gas leak followed a pipe into a residence and started a fire/explosion).
The same is true of other utilities. E.g., the City replaces water meters continuously (rotating schedule). Failures can result in leaks. *Or*, billing errors (often in the consumer's favor!).
It's just a case of expected valuation: is it cheaper to be proactive or reactive? Do the math...