This is preparation for moving the Paintable tree from GC allocation to
ordinary ref-counting. Paintables need tree ownership semantics that
match TreeNode, but their lifetime is about to stop being controlled by
the JS heap.
Add a small ref-counted tree helper and unit tests for ownership,
sibling links, removal, destruction, and preorder traversal. No
Paintable code uses it yet; the behavior change happens in the next
commit.