It’s the result of several different avenues.
During life in slavery, religion would be presented as the place where the little morals slavers displayed came from. “Sure, this asshole has you enslaved, forces you to work most of the day, whips you and will possibly rape your daughter, but the reason he [small act of generosity] is because he’s Christian”. The same religious ideology ultimately condoned slavery, but it wasn’t presented to them that way.
If a slave wanted to learn to read and the means were presented to them, the Bible would be present in some way or another.
During the early decades after emancipation, Christianity was already somewhat entrenched among black people, so the place where they’d gather together in community would be religious rituals.
From that point onwards, black communities being Christian was a self-perpetuating dynamic.
It wasn’t something born out of rationality with all options and perspectives being presented to them, but rather due to circumstance, lesser evils and lack of better alternatives. There are black people who see things the way you have explained it to them - but only after the process of deconversion, which tends to get one alienated from their community.