In 2007 key players (mortgage originators, banks, ratings agencies, governmental agencies and investors) only had incentives for mortgage prices to go up. It was hard to bet on prices going down, and even when you could it was hard to get enough information to realize how overpriced mortgages were. This poorly functioning market resulted in disaster.
The stock market has much more information available, and it is usually easy to bet against prices that are too high. The collective intelligence of many smart people determines stock prices using money, a powerful incentive to get things right. This results in a liquid, well-functioning market with many positive social effects. Google exists today in part because an angel investor knew that if the company succeeded there were well-functioning public markets to sell into. While it's popular to say that the stock market influences company behavior negatively, and causes "short-termism", I believe the opposite:
http://www.newyorker.com/magazine/2015/08/24/the-short-termi...
The market often imposes discipline on managers who would otherwise run companies for their own benefit at the expense of everyone else.
You can tell a similar story for the social benefits of lending money, and the importance of doing it well.
The world has seen a vast improvement in wealth, health, education, and safety in the last 100 years, and I think a large contributor is a financial system that has enabled and rewarded socially useful enterprises.
As I said, this is an oversimplification, and a lot of smart people completely disagree. I don't deny that there are jobs in finance that seem to me to be pure rent-seeking, with negative social value. However, I think that overall the system works well, and that the work I do makes it run a tiny bit better.
Speak for yourself. I've worked in finance for more than 10 years and like my job. Most of the time I work on interesting problems with smart people under good work conditions, and get paid well to do it.
It helps that I work in an area of finance I feel does have positive social value, although doing work I am good at and find interesting is more of a motivation.