[auto-group] Clean up pairing substitution logic