In the backup process, all block from all modules are backed up regardless if the module has been selected for backup. So, during the restore process, the block restore code never checks to see if the pageid remaps correctly. This results in the pageid being set to NULL, causing the restore to fail, or the pageid being set to 0, creating an invalid block_instance record.
Attached is a fix in the restore process. A further fix would be to only backup those blocks that belong to modules that are actually being backed up. Regardless though, I think the attached patch should be added to restorelib.php.