You probably want to cluster your lines by intersection - use ST_ClusterDBSCAN with eps := 0:
SELECT *,
ST_ClusterDBSCAN(<geom>, 0, 1) OVER() AS _clst
FROM <lines>
;
to assign a cluster id (_clst) to connected segments on a per-row basis.
From here you could ST_Union/ST_Collect based on _clst:
SELECT ST_Union(<geom>) AS geom
FROM (
SELECT *,
ST_ClusterDBSCAN(<geom>, 0, 1) OVER() AS _clst
FROM <lines>
) q
GROUP BY
_clst
;
or, in order to find only those disconnected sub-networks, make a selection by ST_Length:
SELECT *
FROM (
SELECT ST_Union(<geom>) AS geom
FROM (
SELECT *,
ST_ClusterDBSCAN(<geom>, 0, 1) OVER() AS _clst
FROM <lines>
) q
GROUP BY
_clst
) q
ORDER BY
ST_Length(geom) DESC
OFFSET 1
;