Seems like further clarification of the needs is required. Should "chained" intersections be allowed/considered as one group? Or discarded.
Since D1B19 and E3A22 intersect, it would seem apparent that a modification to the code would be required to make the output actually put BOTH of those in the same group, i.e.
Again, some logic requirements are needed for muti-grouping (such as happens for D1B19 here).
OP, what is the actual and complete desired effect of this new set of inputs??
Multi-grouping is not allowed. If a series of shapes intersect in a "daisy chain" fashion then ultimately they all belong to the same group. Making the change that Mark describes produces the desire effect when using the recursive CTE. However, when using the CURSOR the line segment E3A22 shows as a separate group. It would be acceptable in this case but not preferred. Furthermore, since E3A22 is not present in more than one group and all shapes are accounted for, it will suffice.
Thank you Kevin and Mark.