Worker bees and worker ants are like cells of a superorganism. They are all clones so no genetic diversity is lost when one clone dies, just as no diversity dies when you slough off skin cells. The superorganism saves resources by optimizing the clones for the environment it exists in. Those resources can then be used to create more genetically distinct offspring. Some of which may have an even more optimized body plan for its worker units.