At the end of The Big Short, Steve Carell's character asserts that the banks weren't acting stupid, and that they knew they were getting a bailout so they just didn't care. Why wouldn't they care? From what I understand the bailout was just a bunch of big loans. Why would you not care about losing a bunch of money and having to take out huge loans?
The movie over-simplifies the large banks' attitudes somewhat. In reality, they differed:
some banks limited their exposure to junk debt (I will use this term because there was junk other than subprime mortgages involved). They'd buy up a little junk, repackage it into new instruments, and re-sell their instruments to clients. So their own exposure to the junk was limited, which is commendable. Their losses came a little later, when the clients who bought the repackaged junk sued them for billions of dollars and eventually won.
some banks were buying up more junk than they could use right away for repackaging - holding an inventory, intending to re-sell it eventually, and hoping to earn more money by holding the high-yielding junk meanwhile. This bet did not go well. (And they got sued too.)
a couple of banks thought they did not have junk exposure, but they were mistaken. One very prominent bank CEO went on TV to tell the public that his bank had no junk exposure. He might have believed it, but a few days later it turned out that all the repackaged junk that his bank sold to clients had a "par put" clause, meaning that the client could require ("put") the bank to buy back the repackaged junk at face value ("par"). When the repackaged junk was trading at about 20 cents on a dollar, the clients massively exercised the option, causing the bank to lose tens of billions of dollars. (And they got sued too.)
Executive compensation schemes award wages, stock options, bonus incentives to the managers in the financial sector. Typically executive compensation is maximized when the firm expands assets rapidly. So managers have personal profit incentives to increase leverage in the balance sheet and increase risk in the financial asset portfolios of their respective firms. In theory managers who hold equity in the firm will take a loss if there are debt defaults in the asset portfolio so this would tend to make equity stakeholders more risk averse.
If banks and financial intermediaries were forced to hold all loans to maturity, and executive compensation schemes include proper incentives perhaps with clawback provisions, then there would be less incentives to "game the system" via executive compensation schemes.
The originate-to-distribute model is one where a bank makes a loan, packages the loan into a bundle with other loans, and sells those loans to a non-bank holding company called a Special Purpose Vehicle (SPV). In this model the mortgage brokers take fees for placing mortgages; the appraisers take fees for services; the mortgage originators take fees for selling mortgages; and there is an incentive to profit by moving risk off the balance sheet to some other balance sheet such as the SPV. I call this "passing the trash." However if the loan originators also gave credit guarantees then loan defaults in the SPV sector would cause default charges on the balance sheets of loan originators. Thus the system can become corrupted by perverse profit and compensation incentives and require a bailout from governments. The government policy must allocate some of the loss to equity owners and/or uninsured investors in debt claims when it acts prevent a large systemic loss that would harm the real economy. The expectation of a bailout increases the odds that many financial executives will maximize compensation without a loss or events that trigger a clawback provision or clawback policy of the government when it provides the bailout.