Fix relationship type selector bug about same-template relationship directionality; refactor into a helper