Trade-Off between Toxicity and Signal Detection Orchestrated by Frequency- and Density-Dependent Genes