Although much of the world is 'religious' it is erroneous to assume that that means there is altruism or love in their religions. Some view bad events as 'karma',the will of a deity or bad energy rather than as an event that offers an opportunity for love and reaching out. In some belief systems it is not against their religion to do something bad (as in crime) to those of other religions. In their system, they are not doing bad, they are abiding by the rules of their religion.
Also keep in mind, that some religions are self-centered. In such religious systems, the person is doing nothing wrong by being self-centered and greedy. Within such a religion, they are adhering to its tenets. The first tenant of such religions is "Do what thou wilt". In other words, do what you want to do.
Even among the religions that 'talk' about doing good works, some have clauses that allow them to lie or cheat or be hostile to those of other beliefs while still claiming the accolades of 'good works'. There are also some religious systems that do not view poverty as bad. Things such as poverty are seen as an accepted part of life or 'fate'. Such a mindset is not new. Even during the Roman empire, some people were viewed as 'fated' to lives of poverty in the eyes of the Roman religious establishment. Poverty is also subjective, depending on which nation and culture one is a part of. What is viewed as poverty in America would be living well in many other nations.
In terms of 'how' it became such a mess, it has always been in a mess. In terms of standards of living, the world now is much better than life during the Middle Ages. The Middle Ages were much better than many early civilizations. Assuming that things are a mess now is also subjective. People are living better now than they have in the previous 1000 years.