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 them. But if the data we give them are as "genuine and unfiltered" as it gets, then it probably shows something about us.
From a cognitive science perspective, it's probably the case that the same heuristics and biases that create stereotypes are also the ones that make us powerful agents (note the similarity between categories and stereotypes), so, at least at this moment, it's unclear how we can segregate desired from undesired behaviour.
To combine the points mode above, it seems we can only either:
Remove "bad content" by curating the data by hand or by some metric that we don't know of yet
Accept that our methods will produce AI as "bad as we are", because 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 more rigorously, it seems like there is no clear cut solution.