Reality is racist. Racism is natural. We've had to force ourselves not to be racist for a reason.
It doesn't mean there weren't any in-group dynamics or discrimination though. Race simply wasn't the focus. People would discriminate based on things like religion instead.
Fortunately we don't have to stay at that level and can over come it to an extent, but claiming it wasn't a thing in medieval and other empires is factually incorrect.