Only groups accept children; non-groups return themselves unchanged.
Node withChildren(List<Node> kids) => switch (this) { final GroupNode n => n.copyWith(children: kids), _ => this, };