Good catch, I made a mental note to myself last night to look into how "tx" records are ordered in the wallet. I think nOrderPos might give the ordering we want (metadata should always come from the transaction the wallet created, not the mutated one seen later).

Doing the metadata copying while loading the wallet is important for clean recovery; I could bump the wallet version number and run it as a one-time conversion, but since performance isn't an issue here (metadata is only cloned in the rare case where a mutant gets mined over your original transaction) I don't think that is worth it.