Generalize handling of merged TypedPipes

This flattens merges all the way out into a List, then checks for duplicates in that list. If they exist, do a local self merge leaving us with only distinct pipes, which cascading can handle.