Nothing is permanent. Everything changes constantly. No party ever stays the same. In the 1980 the Republican party began a conservative movement while the Democratic Party became more liberal. Today the Democrats are leaning socialists and the Republican party is mostly controled by President Trump without a clear political philosopy other than being anit-socialist. Of course it is more complicated than that, but that is a summery.
Switched is the wrong word. Slowly evolved would be better wording. Both Parties changed and the country changed. It is a complicated story. No 'switch' occurred.