Well, it wasn't
just putting up statues and making movies where the Confederates were the good guys -- the 1920s was also the peak of organized white supremacy like the Ku Klux Klan, when lynching and other mob violence was common. The Tulsa massacre, which involved burning one of the wealthiest black neighborhoods in the United States, was only 5 years before this film came out.
You can kind of think of this era as a sort of "anti-Civil Rights movement", and it was the same group of people burning houses and lynching and putting up statues and working politically to keep black Americans disenfranchised. And it's still a salient issue today -- disenfranchisement of minorities (closing polls in minority neighborhoods to create multi-hour waits to vote; gerrymandering to concentrate minorities in a small number of Congressional districts; disproportional felony convictions and the accompanying loss of franchise) is an issue in every election. Hell, one of the initial backlashes against public health measures early on in the COVID pandemic was that the early waves primarily affected large cities and the initial mortality rates were higher for blacks than whites, so it was viewed as a problem more for blacks than whites, and therefore, not a problem.
The white-washing of Lee and the other Confederate traitors is still part of modern American politics -- it reframes the Civil War from a bunch of rich slave-owners rebelling against the United States to maintain their power and privilege, and getting hundreds of thousands of other people killed for it, to cast these men as victims of a rapacious Federal government meddling where it didn't belong. This narrative that was (and is still, eg, Shelby County v Holder) used to claim the Federal government had no right to improve the lives of minorities over the wishes of the States, is now used to claim the Federal government has no right to mandate minimum wages, or environmental regulations, or educational standards, or a thousand other things, over the wishes of the individual States.
So it's still modern politics to cast down Lee and declare that he was not a noble martyr fighting for States Rights against an oppressive Federal government, just a traitor to his oaths who was personally and politically reprehensible. And to point out that States Rights have always just been a political shell game -- Slave States were happy to use the power of the Federal government to override the will of Free States, and force them to extradite escaped slaves back to the Slave States, just like issues like abortion are "sent back to the States" until a Federal ban can be passed, at which point it will miraculously no longer be an issue for the States to resolve.
It's the old quote -- "The past is never dead. It's not even past."