Humanity is the product of evolution through natural selection.
Our minds, egos, self-esteem, consciousness, belief in an afterlife, conscience, guilt etc are fictions created by our evolutionary development. As Nietzsche argued there is no such thing as mind, consciousness, the self. They are, in a sense, illusions created by evolution to produce what is known as humanity. Humanity minus these fictions would not be human. Humans cannot exist without the existence of these illusions. These fictions are necessary illusions manufactured by men.
The body and brain that we possess today are products of the Stone Age. These bodies and brains have hardly evolved since the Stone Age. Consequently they are, in a sense, unsuitable for modern conditions. This is why human beings can act in such irrational ways and why we have psychopaths and other individuals with serious malfunctioning problems. To simply attribute all human problems to capitalism is trite. Nature will be always inscribed on us. We can never escape the limitations imposed upon us by nature.
Humanity evolved these illusions as devices whereby we are more motivated to improve both ourselves and our surrounding conditions. For instance without a sense of self-esteem we would not feel important. Consequently we would not see any meaning in undertaking many activities. If we had never believed in an afterlife we would not found much meaning to life. Consequently there are many things we would not want to do. This is true of the other fundamental illusions that envelope us. Without them there would have been no incentive for the species that evolved into homo sapiens sapiens to socially develop. Consequently there would never have existed human civilization.
In a sense, then, there is a relationship between these three 19th century intellectual figures --Darwin, Marx and Nietzsche.