Perhaps this could be accomplished with yet another perlrun option, maybe -b (for backup). In conjunction with -i (whose behavior it would modify), we could demand that both have non-empty extensions, and further, that no two of the three names reference the same file, thereby defending against foot-shooting behavior like
-i* or -b./* (for which silently
deleting the "copy" might delete the original). It would then be safe to do largely as specified, after step 0, making a copy of the original in the -b extension.
This keeps a backup of the original after the dust settles, much as -i
does now, but also preserves the original, which won't be replaced by the -i version until it has been
completely processed and closed.