Not drawing a tree with the children in the right order

Have you read GoJS Trees -- Northwoods Software ?

You probably want to use go.TreeLayout.SortingAscending or go.TreeLayout.SortingDescending.

If you search, you should find some examples of TreeLayout.comparer. For example: