If you are trying to branch prod (or even a staging db) then you can't
Right. But the obvious solution is to just not do that. Create a template and base production/staging off it, then use that template. Or use the same bootstrap/migration process to create the template as you do staging.
Regular tests shouldn’t assume access to staging/prod, anyway.
So how do you test your migration? Will work fine with 10 records but perhaps not with 10 million.
I don’t consider that “a regular test” but something db-specific that would have a custom workflow.
Eliminating "custom workflows" seems like rather the point of such an extension.
Run it in a transaction, and if it fails, abort the transaction. nbd, did this for years in prod. Discovered some interesting assumptions about sequential IDs in the DB tests while running it against prod under peak load, too!