Interesting task. Would the vertices of adjacent PLINE always share a common location, or is it possible a vertex from one to lie mid-span on another – as in attached image.
If that were the case, I’d be tempted to suggest the creation of temporary REGIONs, UNION, then EXPLODE to eliminate unnecessary geometry. Not an easy task in itself, but may be more tractable than those mid-span intersections.
I do have some demo code for re-creating a PLINE from the constituent parts. I’ll post it if that was a method you were willing to pursue.