Why is Deleting Code so Satisfying?

If I was a plumber then I guess if I hit a situation where I’d put in place a big heating system and a bunch of pipework and I then suddenly thought;

Wait a minute, I’ve just spotted a much better way of doing this!

then I doubt that my next thought would be to rip out all the work that I’ve done and do it all again.

But, if I spend hours and hours writing some code and then suddenly think;

Wait a minute, I’ve just spotted a much better way of doing this!

then it feels great to delete all the work I’ve done, re-do it all again and end up with something more “elegant”.

Is it just because plumbing involves something physical or is there something more going on?