I question this. If by the term "race" you are referring to the realization by one group noticing, and capitalizing on, those different from themselves in language, physical features,etc. than "race" has been a factor for just about forever, and found in every place inhabited by man.
As to "race" being a scientific theory, I'm not sure what you mean. Does it mean human curiosity about why humans come in the endless variety they do? Or why some societies ("race") seemed eternally becalmed in, for example, the hunter-gather stage of development? Is it the fear that in doing so it would cause/encourage one group to consider itself superior to the other(s)? Again, that is hardly a 19th century development.
People tend to be tribal, or to consider others as “different” from their own people. But that is rather different from the “scientific” theories of “race,” which were not fully developed until the nineteenth century.
Thus, for instance, the Greeks considered everyone else to be barbarians (they didn’t speak Greek, and it sounded as if they were saying “barbarbar...”). In India, there was a caste system, but that was based on religion and lineage, not race as such.
The Chinese and the Japanese each consider themselves to be the only real people. And so forth. But again, it’s not race as such.
The Navajos and the Zunis live close together in the Southwest, but their cultures and customs are completely different, and they have different origin stories. Zunis like to live closely packed together and Navajos like to live in isolation. Yet a scientist would say they are both Indians, and racially connected.
It’s the “scientific” angle that distinguishes race from tribe or people or class or lineage or language group.