This is essentially a better fix for bug 894137. Relying on the aNullParent
argument to UnbindFromTree doesn't actually tell us if the dir=auto node
is still in the tree or not. Instead, we can check the parent of the said
node and only reset the direction if the parent exists, which means that
the node is still in the tree.