Racism is as old as the evolution of humans into different species. One can go as far back as Aristotle and find “racism” in his teachings.
However, people became aware of racism much, much later. As the world developed, globalization happened had people from different nationalities and races started to compete for resources, they realized that giving preference to a group of people based on their appearance was wrong.
It was until the 19th century that racism because an issue that people cared about. I would ignore the notion that Islam ended racism in the 7th century, because it would spiral the discussion into a different realm.
Hence, the outlook of racism in Einstein’s time was not the same as it is today, and we cannot judge him from the same lens. He was a genius, but he was still shaped by the society and environment that he grew up in.
If Einstein was around today, it is unlikely that he would have held the same “orientalist” views, and even if he did, he would not write about it in his diary (or Tweet about it), since people today are actively looking for opportunities to accuse others of being racist.
On a more controversial note, perhaps people like Einstein are allowed to be somewhat racist? After all, he was superior to other humans and was probably naturally predisposed to thinking that most humans were inferior to him.
This begs the question - are most geniuses racist, and have the majority of the high achievers in history exhibited racist tendencies?
I think it would make a fantastic research topic.