Capitalism has a lot of ugly side effects not because capitalism has to, but we implemented the wrong model of capitalism. Capitalism, in support of absolutism of freedom, is an oligarchic lie.
To make capitalism work, we must subjugate it to freedom as a relativity theory, in which the merit of capitalism is defined by the value of its contribution to evolution.
See my many blogs on the subject, start here: Rethink Economics, and to your question specifically, Capitalism Without Merit Is a Bold Lie.