Bacterial-induced pH shifts link individual cell physiology to macroscale collective behavior