Really nice post indeed.
I guess it can help when the GUID partition table is wrong while the data remain untouched and consistant. All commands are at the GPT level with the gpt command.
My understanding is your issues are at APFS level : it's the APFS container map one needs to rebuild. So, I'm afraid it won't help much.
We should pay a visit to Apple developer site and its APFS documentation [I still don't have any APFS container to play with].