Discretion is not the key problem. Discretion is a necessary part of the job.
Let me address victimization rates - because yes, they are higher in poorer communities. That does not justify in any way the behavior of police in those communities, which is to randomly pull over/stop and search/etc. people on the street who "look" like bad guys. If somebody kills someone, sure, arrest them and put them in prison. Most "bad guys" sent to prison are not violent offenders (drugs, theft, homelessness, child support, etc.) with drug possession being a huge chunk of it.
https://www.americanactionforum.org/research/incarceration-a...
The culture of policing is the key problem, which is created by a confluence of training, recruiting practices, general societal attitudes, and the political leadership of elected officials. It's not one problem, as you can see - it's many contributing factors.
A local town near me was praised some years back for drastically reducing violence by shifting towards community-based outreach policing. The local news actually called out Chicago for not following its example, you should definitely read about it:
https://www.aurora-il.org/1637/Community-Oriented-Policing-C...
Critics of community oriented policing typically view it as "being soft on crime" instead of a systems problem. The "put bad guys in prison" model has the effect of continuing the cycle of poverty, and measures such as mostly doing away with pre-trial detention (i.e. bond) for non-violent offenders are intended as a systemic fix for the poverty cycle.