Issue with ancestors when moving nodes

I ran into an issue with moving nodes where the ancestors are no longer
correct. This is just a description of the error along with a failing test. I have no solution, I would be extremely grateful if someone did have a solution that they could offer. 

Consider the tree (where 1 and 0 are siblings)

        1          0
         \
          2
           \
            3
             \
              4

if I move 1 to be a direct child of 0 (giving this tree)

                    0
                     \
                      1
                       \
                        2
                         \
                          3
                           \
                            4

then move 3 to be a child of 1 giving this tree

                     0
                      \
                       1
                      / \
                     3   2
                    /
                   4

I would expect the ancestors of 4 to now be 0, 1, 3, instead as you can
see in the failing test it is being reported as 0, 1, 2