Could a necromancer command an undead to act as it did in life?

It’s already mentioned in the 5e monster manual that skeletons uncontrolled will do things they would often do in life.

Independent skeletons temporarily or permanently free of a master’s control sometimes pantomime actions from their past lives, their bones echoing the rote behaviors of their former living selves.

Would a necromancer be able to, more or less, tap into that and perhaps make a skeleton that acts in the way it would have normally in life? And is the same true for other undead?

I know it’d be difficult for the undead in question, as they may not know how they acted in life, but if the way they acted was disclosed to them, could they act in that way? And supposing that the necromancer dies, would they continue to act in such a way with the original order?