Goldwater offered a libertarian justification for allowing the south to continue segregation. And what did that get him? He flipped five Deep South states, at the expense of losing every traditionally Republican state Nixon had won in 1960, with the exception of Arizona. Goldwater lost stalwart Republican states in the Great Plains and Mountain West, like Colorado, that had voted against FDR three out of four times. Supporting segregation was a political loser for Republicans.
Nixon and Reagan did not "run the same strategy." Neither supported segregation. They didn't have to. Democrats, having abandoned their segregationist wing, sought far-reaching government programs and social engineering to remedy economic and social disparities, as Democrats are wont to do. Nixon and Reagan pushed back on those policies, entirely consistent with Republican ideology.
This article does a good job explaining what really happened: https://claremontreviewofbooks.com/the-myth-of-the-racist-re...
> The evidence suggests that the GOP advanced in the South because it attracted much the same upwardly mobile (and non-union) economic and religious conservatives that it did elsewhere in the country.
https://www.nytimes.com/packages/html/books/phillips-souther...
(Similarly, I think you've collapsed the GOP of the 60s too far down; the Rockefeller Republicans were, on domestic policy, square in the middle of where the mainstream Democratic party is today. George Romney would have opposed AOC, but so does Gina Raimondo.)
At any rate, when people debate which is the "racist" party, they almost invariably ignore the fact that the US was a 4-party polity in the mid-century, not a 2-party polity. What's changed since then is that we have, from 1980 through today, sorted down to 2.