The root of the issue is that depsgraph relies on `ID::session_uid` to
identify and retrieve its own cached evaluation data for an ID,
including the memory for the evaluated ID data (e.g. used as keys to
retrieve IDInfo data stored in `DepsgraphNodeBuilder::id_info_hash_`).
This breaks in undo case, when a previously deleted ID is re-read from
the memfile, as it has not matching 'old' ID which address could be
reused. So while keeping its previous `session_uid`, it has a completely
new address, while the 'cow ID' retrieved from the depsgraph will still
have its `orig_id` point to the old address.
This commit fixes the issue by re-setting the `id_orig` pointer of the
`id_cow` evaluated data, when it already exists and is re-used.
This allows to keep the same `session_uid` for IDs on undo, even when
they are 're-created'. However, it is somewhat more risky than !146028.
Pull Request: https://projects.blender.org/blender/blender/pulls/146029