A big part of the problem is that while culture treats good and bad as right and wrong, the larger reality is it is the basic biological binary of beneficial and detrimental. The 1/0 of sentience.
That's because it is the function of culture to synchronize the community as a larger social super organism, based on the same languages, rules, measures, etc. Basically the decision making has to be black and white.
While the reality is that too much good can be bad and that dealing with the bad is educational. no pain, no gain. Our intellectual functions are a consequence of dealing with the problems, not basking in the pleasures.
As for racism, what could be a more basic group signifier than the color of one's skin? That's why armies, as well as sports teams, tend to wear different colored uniforms.
Much of what becomes formalized has been systems of divide and conquer/control, as Bob Dylan observed about Jim Crow laws being originally designed to keep poor whites and blacks connecting along class lines, after the Civil War.
Getting beyond that means understanding there are angels and assholes in all creeds, cultures, colors and classes and when the assholes are in charge and leading the way, things are going the wrong direction.