Prior selection prevents the loss of an ecosystem cycle during acidification