I'd say the coding and testing toolchain doesn't work most of the time. In fact it rarely does. But since we only see code changes that didn't kill the entire system permanently, we're left with a a huge amount of legacy trash and a few things on top of it that worked out by amazing coincidences accumulated over millions of years.
So what you're saying is that the universe does cargo cult :kekw:
It's even worse. A cargo cult has a reasonable, comparatively narrow scenario or goal to start with.
I mean, from the universe's perspective, the whole of Earth is a quite small thing
There's an integration test called natural selection.