Yep, get_children() is only the first direct child and get_next() finds siblings, not grandchildren.
A recursive count function:
func recursiveCount(item):
if item==null:
return 0
var count = 1
var child = item.get_children()
while child!=null:
count += recursiveCount(child)
child = child.get_next()
return count
Call that on your root node and it will count every tree item (including the root).
print(recursiveCount(tree.get_root()))