Final (I hope) update: Took the bike out for a shakedown ride early yesterday evening and it ran very well. So well that I extended the ride and took it up some slightly more gnarly bits in the Pentlands. Didn't miss a beat. Better still, the creak that would occasionally emerge from the motor area on a left pedal downstroke has gone, thanks to some advice I found up online while Googling around for help with the other woes that I had got myself in to. Turns out that the bolts by which the motor is attached to the frame often either aren't properly tightened during the PDI, or manage to come loose (despite having nyloc nuts). On re-installing the motor I ensured that they were properly torqued up and bingo, creak gone :)
There are a couple of things I still want to knock properly on the head* but for now I'm just happy to be able to ride it again.
@IWRATS: As a former electrochemist with an interest in pitting corrosion I would love to know how the crank and shaft got so intimate.
I've taken of photo of some suspicious-looking flaws in a couple of the spline channels on the butchered crank - see here. No idea whether they were the cause of the problem, or how they arose. I couldn't see any corresponding marks on the spindle splines. What you can also see in the photo is how the offending washer I mentioned in a previous post flattened over the exposed ends of the splines on the crank - before the extractor tool stripped the threads. My new cranks are attached with FSA self-extracting bolts (which work like a charm) with properly captive washers so fingers crossed I won't have to deal with that particular drama ever again.
* First: the chain is a little bit noisy at the chainwheel when on the three largest sprockets. I've checked that it's not rubbing anything in the chain path, or against the lockring/chainguard. I think it's actually because of the chain angle on those sprockets. I've checked the chainline by eye and it looks to me like the chainring is aligned with the middle sprocket of the eleven, which I would assume is right. Maybe it's because the larger sprockets 'release' the chain that bit later cf the smaller ones. It's only noticeable on the work stand, not when riding. The new chainwheel has the same 3mm offset that the original one had, which is required for the boost rear axle. I see that FSA do a chainring with a 2.5mm offset and I'm considering trying one of those to see whether it makes a difference. (I've already tried reversing the offset chainring on the drive shaft and in that "zero offset" configuration the chain fouls the tyre on the big sprockets so it's clearly just a question of fine-tuning, not something fundamentally wrong.)
Second: I noticed when fitting the new cassette that the lock nuts on the freehub cones seemed to be loose - one of them started to come undone when I was turning the axle by hand. I've no idea how long they've been like that, and it's literally decades since I put a tool anywhere near a cup and cone bearing. I've no idea where my cone wrenches went! I've tightened them up as best I can by hand for now: the wheel turns freely with no discernible play, and the valve drops nicely to the bottom. It's a thru axle so I think so long as the nuts are snug when the wheel goes in they're not going to go anywhere once the thru axle is torqued up. I've turned up a Shimano service document which indicates that fettling cup and cone bearings on thru-axle freehubs is much the same as it ever was on older-style axles, which is good to know. I now have a couple of cone wrenches of the appropriate size on order so I can at least do them up properly.