[2.2] ExpandPipe should use relation type indices when possible

This change lets ExpandPipe use relationships ids instead of names whenever all ids in question are resolved.