treeify: fix various strip-root cases

Now both "foo" and "/foo" are stripped correctly without resulting in
false ghost elements. The conflicts with fake-root ("@bar") were fixed
as well.
treeify: preserve leading / in stripped root