Fix assert on Node::parentNode() for root
Before this commit, because of both parentNode() not checking
for parent() existing and createNode() not checking for the node
existing (which in this case was originalNode->parent()),
trying to access parentNode() of root node would result in an assert
or crash.
This commit fixes that behaviour in both places.
BUG:420317