If you look at the vote totals you'll see that far more Republicans voted for the Civil Rights Act of 1964 than Democrats and that far more Democrats voted against it than Republicans. The Democrats did not suddenly decide to support civil rights since the majority of the opponents of such policies were Democrats. Much of the violence against blacks you see from that era were committed by Democrats. I seriously doubt there were Democrats out beating blacks for demanding civil rights one day and literally the next day they were voting for civil rights.
That situation was far more nuanced than the idea that millions of people with opposing viewpoints across the entirety of the country suddenly agreed with each other to switch parties.
As for the southern strategy, there is the viewpoint that getting people to vote for you doesn't automatically mean you accept and enforce their ideologies. They just become "useful idiots" for your cause. Although, I disagree with the premise of the strategy because it would have the side effect of fostering racial divide. But I have the advantage of hindsight in that matter.