Joining a raspberry Pi to an external hard disk cage power supply
It might work, but I wouldn't recommend it.  Purely because the components in the power system for the HDD enclosure will be sized for running a hard drive.  The controller board will include a 5V regulator, and a 3.3V regulator. That 5V regulator may not be able to reliably provide both the power for the HDD and the Pi.

Instead I would recommend adding a second power board that takes power direct from the 12V input and converts it to a separate 5V supply just for the Pi.  I'd recommend a switching power supply, and the simplest form would be a UBEC (Universal Battery Elimination Circuit) used in many RC vehicles, and available from most RC stores both online and otherwise.