Of course, you are right that pursuit of individual self interest can be
collectively self defeating. There is a large body of literature on this
(The "Commons Dilemma"). A good example is to have a large numnber of children
if you are poor in a poor country. Many of the children will a woman has will
not themselves survive to adulthood. Yet is is surviving children who will be
the only form of "social security" such poor people will have if they survive
in their old age (as well as providing a labour and income benefit while they
are children before their bodies get broken by exploitive and unscrupulous
working conditions to which they are subjected). Of course, having a total
fertility rate of 5 or 6 children per woman in countries that are among the
poorest of the poor is not beneficial for the society as a whole. The
"invisible hand" isn't quite what Adam and crew made it out to be.