Text this: Flexibility-Induced Collective Behavior Drives Symmetry Breaking in Discrimination of Undesired Ions