In pre-WWI South Africa, the communists and radicals fought for the right of the (white) workers to continue to exclude black competitors from the mines and factories.
Just finished reading a looonnng book about the philosophies behind the Lincoln/Douglas debates. The author points out that throughout American history, at least up to the 1950s or so, the party generally on the side of “the little guy” as opposed to The Man, was almost without exception more racist (anti-black, anti-Indian, etc., than its comparatively pro-business and upper-class rival.
Throughout this period, the party that appealed to “the little guy” was the Democrats, while their rivals were first the Whigs and then the Republicans.
As you say a large component of the Democratic Party switched sides on this during the 30s and 40s, though I’m a little more conciliatory than you and assign much of the switch to a reaction to the obvious example provided by Nazism of where racism leads.