This problem shows you how to modify a tree in place. You do not create a new tree. You change the existing one by swapping pointers. The pattern applies to other tree changes: flattening a tree to a linked list, rotating nodes, or pruning branches. You need to identify the local change (swap, delete, rotate) and trust recursion to apply it everywhere.
Always return the root after modification. Even if you change the tree in place, returning the root makes the function composable and easier to test.