Helper to traverse nodes in pre-order.
Refactor to shift some responsibilities from TableContext to TableNode.