He helped pass the Civil Rights Act of 1964 and the Voting Rights Act of 1965, just seems strange when you at it objectively like that.
I read a parts of biography on LBJ in my undergrad, The Years of Lyndon Johnson by Robert Caro. It's quite huge spanning 4 volumes(with a fifth coming eventually) but one thing that was discussed was his change of heart on the subject.
In an interview Caro mentioned that in Johnson's first 20 years Johnson was very much a Southern Democrat and voted entirely with the South. Caro states that it's entirely Johnson's cunning and his compassion that led him to change from a traditional WSD to what Johnson is remembered for.
The reason it’s questioned is that for no less than 20 years in Congress, from 1937 to 1957, Johnson’s record was on the side of the South. He not only voted with the South on civil rights, but he was a southern strategist, but in 1957, he changes and pushes through the first civil rights bill since Reconstruction. He always had this true, deep compassion to help poor people and particularly poor people of color, but even stronger than the compassion was his ambition. But when the two aligned, when compassion and ambition finally are pointing in the same direction, then Lyndon Johnson becomes a force for racial justice, unequalled certainly since Lincoln.
So to answer your original question it really just seems that it was just Johnson's nature as a person to be compassionate to the less fortunate, regardless of race.