All political parties exist to win elections based on their principles & beliefs as spelled out, for example, in their party's platform.
Verginius Rufus: "When they realized that they could be the dominant political party while writing off the South, they did so."
You can just as quickly accuse Republicans today of "writing off" our big cities, which have been run almost exclusively by Democrats for, in come cases, over 100 years.
But the truth is that every big city has a Republican party who millions of voters hope to elect.
But they only occasionally succeed -- i.e., Rudi Giuliani.
Is that the Republicans' fault, or is it simply there's often no way for a Republican to win and still be a true Republican?
Same for many decades in the Solid Democrat South.
Verginius Rufus: "A few of them may have been genuinely interested in uplifting the freedmen but most Northerners of that time were just as prejudiced towards black people as white Southerners were."
Only if by "most Northerners" you mean Northern Democrats, partnered with their racist Southern Democrat allies.
Northern Republicans did not write the kinds of Black Codes, Jim Crow & segregation laws typical in the racist Democrat South.
Verginius Rufus: "Between 1860 and 1912 only one Democrat won election to the Presidency (Grover Cleveland, twice), and Wilson only won in 1912 because the Republicans split between Teddy Roosevelt and William Howard Taft."
Demonstrating that Republicans had a successful election strategy which worked for them until the Great Depression and FDR's "New Deal" caused a long-term sea-change in voter attitudes.
New York did not pass a law against discriminating against people on the basis of race in hiring until 1948.
I had a great-great-grandfather who served on the Union side in the Civil War in Missouri. He later ran for office as a Republican but lost (I don't know which year or for what office). His brother was a Confederate.