This is the howto:
1. Flash a stock image (I used the August stock image MTC20F)
2. Fastboot flash TWRP 3.0.2-0
3. Boot into TWRP
4. Select Wipe -> Advanced Wipe -> Select and repair each partition individually (some won't be able to, and that's fine, just move on to the next one)
5. Restore a full nandroid backup (make sure everything is selected) and reboot
6. You should now be free of the never ending boots, and if your device is bootlooped at this point (stuck at the boot animation), you can just flash stock again.