Building boot caches on boot helper partition failed
I have fixed my problem. Before the crash of my hard drive, I was using Yosemite as OS. Apparently you cannot restore a backup made in Yosemite with a bootable USB of either Mavericks or Sierra or with the network restore of Lion.

I eventually made a bootable USB drive of Yosemite and reinstalled a new copy of Yosemite on my new HDD. After installation I used the Migration Assistant to retrieve my data. This took several hours, but afterwards I could normally reboot my computer. I had tried this same procedure with Lion, Mavericks and Sierra, but that didn't work and the computer wouldn't boot.

So if you find yourself having to restore a time machine backup, use a bootable macOS of the same macOS version you were running.