You need a USB C “Power Ctrl+Z” key. Unlike the regular Ctrl+Z key one of these bad boys is capable of reversing edits across system reboots until as far back as when you originally plugged it in.
From what I understand, you could un ironically do this with a file system using BTRFS. You'd maybe need a udev rule to automate tracking when the "Power Ctrl+Z" gets plugged in.