Separate the "insert nodes into group" operation into more distinct phases. This helps to clarify what is actually happening, to avoid redundant updates to group nodes every time a new socket is discovered, and to make use of the topology cache to avoid the "accidentally quadratic" alrogithms that we have slowly been removing from node editing. The change is motivated by the desire to use dynamic node declarations for group nodes and group input/output nodes, where it is helpful to avoid updating the declaration and sockets multiple times.