It is not the criminal justice system's responsibility to solve most social problems. The criminal justice system is something of a blunt instrument that is not well suited to solving social issues.
On some issues, the criminal justice system can and should be of help. Drug use is perhaps the biggest of these. The criminal justice system should move towards getting treatment for, rather than incarcerating, many of those who are charged with drug-related offenses.
However, there are many more problems, such as gang membership or gang violence, that are not really well-suited to what the criminal justice system can do. These sorts of problems are better addressed by other parts of government or by private organizations like churches.