Well, you do have a talent for pushing corner cases.
The problem is that the OPFs in your hierarchy have conflicting definitions for some custom columns. The code that detects that situation is broken. It is hard to test it, unfortunately.
Attached is a new version of the restore code. I hope it fixes the problem. Unzip it and put the resulting file restore.py into your calibre installation directory in the folder src/calibre/library.
Please a) let me know if it fixes the problem, and b) remember to remove it the next time you upgrade.