This also used to happen when an underground pipe was connected to on of its sides. This behavior got fixed recently and I guess not fixing this behavior for upgrading underground pipes wasn’t an oversight.
Upgrading underground Pipe II to Pipe III removes above material
I would have to test it since I went underground with pipes II to begin with.
I can confirm the material above the pipe gets removed when upgrading a covered pipe from Pipe I to Pipe II

Thanks for your report. This was fixed in our last patch and shouldn't be happening anymore.
If by last patch you meant 0.42, it definitely happened after that.
i can confirm it is happening. here a save were it happens 100%.
ad.save
Files not imported: ad.save
This ticket is closed, will the devs even notice?? If not, could you guys reopen? Need to update my pipes to Pipe IV 🥲
I made a ticket about underground pipes being disconnected, see Underground pipes being disconnected when building transports on top., might be more related than I first thought..
Was this capability originally intended by the Devs?
I do like that it seems to be a 'By Design' thing now.
If we don't get underground pipes like in Factorio I can live with that for this reason.
Closed as ✅ Fixed
