Error dialogs should say "An error occurred. Do you want the refund for your phone to be sent to the credit card you purchased it on? [Yes] [No]"
As a developer, I fall very near the total perfectionist end of the spectrum in my preferences, but what you’re asking for would probably mean ~nothing ever ships.
It’s not that provably correct code is impossible, it’s that the economies of software (even free/open/labors of love) and physics (time) impose tradeoffs for the vast vast majority of software people write outside a research context.
I too wish software quality was substantially better. I put a lot of effort into not only making it better, but making it easier to make better software in the first place. But the level of perfection you’re describing is unrealistic.
And before you say a fork is unrealistically simple, a metal fork is still the result of centuries of metalworking, casting, mining, etc. I'm sure some early forks did fall apart. But now, we have it refined, and they're close enough to bug-free.
I think the way to achieve it is to have a fixed feature set that you never add to.
Metal forks don’t lose a prong, but their prongs do bend. They do get scraped in garbage disposals. They do get hot when left too long on a heated surface. Some (silver) forks are considerably softer, amplifying those failure modes. And while I’m sure there must be fork vendors who offer solutions with guarantees against those failure modes—there are niche products for nearly every imaginable niche—the vast majority of people knowingly buy forks with these known limitations, trading some reliability for economy and utility. If everyone had the expectations you seem to have, very few people could afford forks at all, and they very well may not have been developed because the market would be so small.
In any case, tying quality to some tangible, bold measurement like refunds is not a bad idea.
If you impose a cost on a user, you compensate the user for that cost. I think that is the basic idea behind tort law. To keep lawyers and associated expense out of the system, do it voluntarily.
But if voluntary compensation of users is being ignored, a change in liability doctrine for software might be in order. Start with the biggest players who can afford the legal costs to resolve the doctrinal issues.
You already offer a refund to users where the hardware fails. Why not the same for the software?