It is only natural for any living organism to want to protect it's genes from dying out, the proof of this is quite simple:
Consider an organism that does not wish to protect it's genes, it will take no actions to keep it's genes within the genepool, and will take it's genes to the grave. Now if you apply this logic to every living organism, you'll see that the only species alive today are those that take actions to survive, reproduce, and preserve their genes; Because any species that is apathetic about survival will go extinct. Because this behavioral pattern is fundamental to survival, it would be beneficial for it to be encoded into the organism's genes instead of having to be retaught every generation; which is what you see if look at literally any lifeform on earth, bacterium are not taught to do this, fish and birds and reptiles are not taught to do this, any species you can think of today is alive because it's genes force them to take actions that allow survival and reproduction to happen.
Moving on, the simplest definition of a person's race is a specific set of genes common to them and other members of their race that distinguishes them from other racial groups. Please note that nothing I have said so far has anything to do with politics. By applying the same logic as before but with the focus on genes that encode for a person's race, we get the same result: any race that is apathetic about it's survival goes extinct, leaving only races that care about, and are capable of, surviving.
The difference between these two concepts is that a race can go extinct even if the species survives, since races are simply a subpopulation of the entire species. Therefore in order for a race to survive, it must have some defense mechanism against interbreeding. For the most part this simply means avoidance, if you are not in the same geographical area as another race then you certainly aren't going to be boning their daughters. This right here is the very foundations of every family, every tribe, every nation that has ever existed, it is almost the entire purpose of having a country.
After typing all of this up I've realized that there is quite a bit more I could say but I feel that i've covered enough. OP, the nazi's did not invent the concept of survival, nature did.