Change call order for tree merge

Tree merging was causing the sp2segment map to be incorrect when the
merge boundaries were being refined. Postponing the merge until after
boundary refinement fixes the issue.