I haven’t seen a theory for why all living things aren’t as nasty as possible in as many dimensions as possible. Why aren’t all creatures poisonous in several ways, foul-smelling, covered with armor, and sharp spikes? It would seem beneficial to have developed every way possible to prevent themselves from being eaten by predators, or attacked by those seeking the same resources.
Apparently there are countervailing forces that are more important. There are energy costs to developing the defensive and aggressive strategies, otherwise all living things would have adapted as many of those behaviors as possible. For example, insects are exposed to the life threatening challenges of the world, and each species has developed some successful working methods for bodily self preservation of its members, or their species would have vanished long ago. Most have emphasized some particular method to cope with these problems, but why haven’t they developed and maintained every possible mode of defense and aggression?
Typically those insects that eat leaves develop camouflage that matches the leaves they eat and stay still while eating. Being immobile most of the time they have taken on the colors, patterns, textures and shapes of the materials they are typically sitting on, and they remain motionless as much as possible. On average this camouflage is enough to prevent their predators from seeing them and eating them, and the ones that don’t match their food, or move more than their kin, get eaten more often and don’t have offspring. These insects can devote their food energy to quiet healthy living. It takes little energy to grow up to be a particular color, and almost none to maintain the color. Patterns matching their food source’s appearance add to the camouflage and it would take more DNA programming to create the patterns than to create a single color, and creating a bodily texture would take even more selected programming. Even greater energy would be needed to create the proteins to create the physical effects in the morphology. Once those systems are in place those insects which have the programming to take on strange bodily shapes would require extra energy only when they felt it necessary, as when responding to a predator nearby, but it would require an additional stimulus response type of DNA programming for the behavior to function. The energy required for programming the DNA for these adaptations is minuscule, but real. The physical manifestation of the ability might cost a lot of energy. Skunks have only a few shots of stink, so they hesitate to use their supply. The creations of bodily poisons, odors, spikes, and structurally complex bodily shapes all take energy, and that energy is not available for other life processes. It is the whole process which is kept in multidimensional balance with multiple life processes.
Ultimately, it would appear that all life is a balance of energy acquisition for bodily needs versus energy dispersal. Energy is based on the acquisition of food, and maintaining a bodily heat balanced with the environment. The acquisition of food energy requires taking some risks in the form of going out from the safest possible places of resting, to acquire the food, and also finding the most comfortable temperature that requires the least food to create the bodily heat balance. There are other factors too, like growth, but without energy none of it can progress, and the individual dies. The creation of defensive measures is balanced with the energy cost of developing them and the frequency of needing to use them.
The answer to the original question, “why all living things aren’t as nasty as possible” would be, it doesn’t work. The DNA of a species is functioning by maximizing the total quantity of its DNA, and its phenotypes which live best are those which satisfy this trend the best, and the proof of this idea is found in those that are actually living.