I’m not sure what it means for US police to have “evolved out of” slave patrols in places that never had slaves, like New York City (northern states didn’t want to enforce the Fugitive Slave Act), or even in places like Hawaii that were founded well after slavery was abolished.
They still exist for that purpose in the US.
They do not exist to protect people. They are a tool of the state and capital.
The years post slavery still were used to enforce Jim Crow laws, segregation, and violence against minorities. They still used dogs to attack peaceful protestors. SWAT teams are a continuation of an ethos of being warriors, willing to do violence at the behest of the government and capital at the expense of the people.
Assuming you are not making the entirely reductionist argument that requires every law be tied back to capital (in other words, murder is illegal because it brings down property values or something) this is an extremely narrow view of the purpose of police. This everything-is-capital framing doesn’t explain consumer protections or environmental laws or labor laws.
The purpose of police is to enforce the laws. Many of those laws have been significantly and disproportionately controlled by corporate and monied interests but again there are too many clear counterexamples to conclude as you did.