Hi Dan - really not what you want at the end of a rebuild, like you say you always start to fear the worst - I've had a few of these type moments in the past :-[. Sorry but this is going to be a bit long winded!

I'm not a mechanic or engineer but OK if I offer some common sense things to check? (you've probably gone thru' them anyway). I believe you're right about the injector wiring, lower ones being the primaries.

From what you've said, after priming, the engine ran OK at first so mechanically it's unlikely anything has come adrift, particularly if you've only had the valves reshimmed & no other engine stripping. Plugs, leads, coils were OK & in the right firing order otherwise you'd have had an obvious misfire straight away. Engine was getting fuel and air OK.

The engine clunking, banging and rattling doesn't automatically mean mechanical, highly likely to be one or two cylinders not firing properly or trying to fire at the wrong time (hence your explosion, bit extrem though !) . So what changed after you switched off, possibly nothing although something could have shaken loose or just failed electrically during the initial run.
You say the engine still turns over on the starter so check:
- that you now have the injector loom connected correctly. Check independently please don't assume I'm correct
- that you did actually tighten your new new plugs & push on the leads. Are the leads touching each other causing two plugs to fire at the same time (I've had this on V8 engines)? Connectors to the coils OK & properly on?
- Check the coils are functioning. Check the resistance - Google how to
- have you crushed any ignition/ecu wiring during the refit ?
- you haven't crushed or forgotten to connect any vacuum hoses to the fuel tank or airbox?
- Does the fuel pump prime normally when the ignition is switched on? Was the fuel fresh and enough of it?
- Can you test the fuel pump for sufficient pressure, are there any clogged fuel filters. Crap in the bottom of the tank ( don't do this, you'll only make the situation worse!) ?

Not exhaustive checks but I reckon you'll find it's probably electrical, possibly fuel. I'm sure mechanics on the forum can probably guide you better but thought I'd add some ideas based on my long list of personal 'didn't quite get it right first time ' experiences. Good luck and let us know what it turned to be

Mike