People from the distant past are forgiven for believing that the earth is flat
Interesting analogies and interesting questions! Two very modest initial observations:
The idea that most in the past believed the earth is flat is open to question; there is an interesting book called (something like) the myth of a flat earth.
Another point that is a bit less modest: substantial numbers of whites in the 18th century did not believe that blacks were subhuman. More on this below in connection with a comment on David Hume.
You are right about how views change substantially in both science and ethics, and while in the 17th and 18th century European (and eventually American) views on slavery shifted, in the ancient Greco-Roman world slavery was considered as basic as any natural, unsurprising phenomenon. I suggest that in cases when, in a society some practice like slavery is thought of as natural and without a live alternative, then those who participate in the practice are less culpable than those who realize that slavery is unjust and that there are alternative cultures and market economies that can function without such injustice. Switching from slavery to what today we would see as clear cases of racism, I suggest that if a person (Jones) is brought up in a culture which deems a particular ethnic group inferior and this seems supported by those in authority and perhaps it is even endorsed by those who are subjugated, then Jones seems to share in the collective blame-worthy or injustice of his/her culture, but Jones is not individually as culpable than in a setting where Jones is confronted with (or Jones can and does conceive of) an alternative.
Two additional points worth noting.
First, when one comes to realize the horror of white supremacy, there may be a more radical shift than what occurs when one realizes that the earth orbits the sun. When one comes to realize that the sun does not orbit the sun, one might still talk as though the sun sets and the sun rises (we might and do even navigate using the sun and stars based on the assumption that they are moving,not us), even though it might be more accurate to speak about the orbit of our planet and when it is we can or cannot see the sun. But once we see the equality of all races, it would not be appropriate to talk as though they are not equal.
Second, looking back at the 17th and 18th century it is hard to assess whether the persons of that time who maintained the inferiority of blacks made an honest effort to look at the available evidence. The case of David Hume is quite vexing on that point. If you do a search for Hume's racism on the web you will find some interesting links. Years ago, I compared Hume' treatment of the evidence reporting that there were miracles (evidence Hume rejected) to his treatment of the evidence reporting that there were blacks who were poets, artists, and as gifted as whites. I hasten to add that I (and my co-author) did not argue that because Hume was wrong about black inferiority therefore he was wrong about miracles! But we did point out how Hume's reasoning in both cases was analogous. (Our article appeared in the journal Philosophia Christi). A lingering concern in the case of Hume as with Kant as well is whether his blind spot (or failure to seek out counter-evidence to the view he adopted) was something he was personally responsible for (in terms of vice) or whether he was part of a larger group and thus sharing in some collective guilt or shame but individually not culpable.