Some problems need passes instead of . For example, computing diameter for each root requires tracking two longest paths per node. You track the longest path down into each subtree, then combine that with the longest path coming from the parent. Some problems combine rerooting with lazy propagation or segment trees.
For instance, if node values change and you need to recompute answers quickly. This is rare but possible in advanced problems. Most competition problems stick to -pass rerooting with simple combine functions like sum or max. Learn the basic pattern with those problems before attempting multi-pass or hybrid solutions.