Demographics don't tell the whole story, but it's important to note that the first non-white elected official to set foot in the Congress, Hiram Revels, was elected in 1870. That means for almost a century, federal laws and policies were set by white men, many of whom were enslavers, virtually all of whom saw their wives as their complement, not their equal, and their daughters as future wives and mothers. Jeannette Pickering Rankin, the first white woman elected took office in 1880. The first Black woman, Shirley A. Chisholm, was elected in 1969.
To be sure, there were abolitionists in Congress for most sessions as well as those who believed Indigenous American tribes and nations deserved equal treatment. There were those who supported white women's right to vote and likely those who had a same gender partner or a family member with a disability. The US government, though, as a whole takes a lot of convincing to move towards civil rights for non-white, non-men, non-straight people.
Basically, the primary work of men like King and organizations like the NAACP was persuading white men with access to power that giving Black Americans rights was in their own or the best interest of the country. And to put it bluntly, it was a hard, uphill slog. The NAACP, originally known as the National Association for the Advancement of Colored People, was founded in 1909 with a variety of goals including drawing attention to and ending lynching. They lobbied for the Dyer Bill, which would have lead to prosecution of local law officials who failed to prosecute lynch mobs. While it was passed in the House, the Senate didn't pass it, or any other anti-lynching laws.
The NAACP did, though, make progress when it came to the courts. However, it took combining multiple cases and presenting overwhelming evidence in cases like Brown v. Board of Education to achieve rulings that advanced the civil rights of Black Americans.
Because of the nature of how government works in the US, Black Americans had to persuade a majority of office holders. In some cases, like Presidents Kennedy and Johnson, they were able to persuade a man with considerable power and sway. Johnson made the call, persuaded in part by members of the NAACP and men like King, that supporting the Civil Rights Act was politically advantageous.