Why not just program the loader into the target, use the loader to install your
main program code, then simply read it back, save it, and use that to program
the rest?

Assuming you're not using a loader that write protects the loader firmware
region, that would give you a single .hex file to program the remaining units,
and you wouldn't need to do anything special except read back & save the
1st one.