Arguably the specific form of racist dehumanization and invention of race itself came about as ideological justification for an already existing slave practice.
e.g. the Romans kept slaves on a huge scale, but never bothered with a racist ideology to justify it. They just dehumanized almost anyone, their ethical system permitted blatant "might makes right." But the nominally Christian ethical system predominant in our most recent western society required a "reason" why slavery was permissible, and so we got the invention of race.