Bacterial Quorum Sensing Stabilizes Cooperation by Optimizing Growth Strategies