It's important to note that ultimately, the statistical methods we currently use in ML research are just that: statistical methods. So when they show some "bad behaviour" it's not because of problems with the statistical methods, but with the data we give it. But if the data we give it are as "genuine and unfiltered" as it gets, then it probably shows something about us.
From a cognitive science perspective, its probably the case that the same heuristics and biases that creates stereotypes are also the ones that make us powerful agents(note the similarity between categories and stereotypes), so at least at this moment its unclear how we can segregate desired from undesired behaviour.
To combine the points mode above, it seems we can only either: 1. Remove "bad content" by curating the data by hand or by some metric that we don't know of yet 2. Accept that our methods will produce AI as "bad as we are" cause that's what we are, and let it operate under the knowledge that it might produce undesired behavior sometimes.
Unless we have some crazy new theory of mind that we can begin to analyze this in a more rigour manner, it seems like there is no clear cut solution.