Keep in mind, the role of Democrats and Republicans in 1866 were reversed from today. Then, the Republicans were Carpetbaggers, disenfranchising those who had fought for the Confederacy and trying to ensure a strictly black government in the South.
The GOP was never the racist party that the Democrats were. Go on up to the 60’s and Bull Connor. See Robert Byrd.
democrats have always been democrats.