True polymorph can turn a creature into another creature. When it does so, the creature "retains its alignment and personality", although its other statistics change.
However, true polymorph can also be used to turn an object into a creature, and a corpse is an object. The portion of true polymorph which covers turning an object into a creature does not mention any retained personality or alignment, which is sensible because objects typically don't have a personality or alignment.
Thus the question: If Creature A dies, then their corpse is true polymorphed into Creature B, does Creature B retain the personality and/or alignment of Creature A?
(Note: I have used true polymorph as the sole example because I haven't found any other spell that can be used in a similar way. If there is a spell I've missed, feel free to answer with regards to that instead or as well.)