When replacing a node and its operand, replacing the operand node may
cause the deletion of the original node leading to an assertion
failure. Case around these replacements to avoid this without relying
on inspecting the opcode of deleted nodes in various
DAGCombiner rewrites dealing with value extensions.
Fixes PR32515.