Dems didn't "know" they'd be losing the South, but LBJ certainly feared it. He, of course, was the one who pushed the Civil Rights Act through the Southern-dominated Senate; Bill Moyers recounted that: "When he [LBJ] signed the act he was euphoric, but late that very night I found him in a melancholy mood as he lay in bed reading the bulldog edition of the Washington Post with headlines celebrating the day. I asked him what was troubling him. "I think we just delivered the South to the Republican party for a long time to come," he said." [0]
Long-term changes in voting patterns don't happen in one election, and they're a multi-variate phenomenon. In 1976, Carter was the incumbent, a Southerner himself, and a beneficiary of the Watergate fallout and the Nixon pardon. Reportedly, his own pollster "Patrick Caddell stated that televisions ads by the Carter campaign in the south 'were blatant-waving the bloody rebel flag'. To avoid being viewed as a liberal in the south Carter campaigned with [George] Wallace and voice[d] opposition to welfare and support for balanced budgets and national defense. He also campaigned with segregationist senators James Eastland and John C. Stennis." [1]
Before that, in 1964, Goldwater opposed the Civil Rights Act, and in that year's presidential race, he carried the Deep South, less Florida with its New York retirees, plus his home state of Arizona — and that was it. Previously, the South had been solidly Democratic since Reconstruction (except for war-hero Ike).
In 1968, "segregation forever" third-party candidate George Wallace carried most of the Deep South.
The 1972 election pitted the supposed peacenik Democratic candidate George McGovern against incumbent Nixon.
In 1980, Reagan famously announced his support for "states' rights" and excoriated "welfare queens," both of which of course were dog whistles to Southern segregationists. [2]
[0] https://www.google.com/books/edition/_/x-o9qAO_oEEC?hl=en&gb...
[1] https://en.wikipedia.org/wiki/Southern_strategy#1976_electio...
[2] https://en.wikipedia.org/wiki/Southern_strategy#Reagan's_Nes...