Ten years ago, the nation’s banking system collapsed, prompting a massive federal bailout that likely prevented a second Great Depression — but couldn’t contain the enormous instability that still plagues the American economy and which contains the seeds of a potential sequel.

That doesn’t mean a crash is imminent, or that policymakers in Washington didn’t take steps to make the banks safer, because they did. But they also made the financial system less safe in some ways, while ignoring a finance truism: Banks, brokerages and investors will take risks, and there will always be a time when they lose so much money that they’ll collapse.

And they’ll take substantially more risk when the government subsidizes their recklessness, as it did during the runup to 2008 and as it’s now doing.

The Lehman Bros. bankruptcy (on Sept. 15, 2008), and the wider collapse, and the atmosphere of risk-taking it was part of, didn’t occur overnight. It was a slow burn, comprised of many smaller blowups in the preceding decades and the government’s attempts to clean them up.

In 1998, for instance, the big banks and brokerage firms did business and copied the money-losing trades of hedge fund Long-Term Capital Management, faced gargantuan losses and were saved by a Federal Reserve-crafted bailout.

That safety net encouraged banks and brokerages to behave stupidly. That’s why the banks created all these fancy investments tied to real estate loans that can be packaged and sold to third parties, or just held at a profit.

They were said to be “safe” investments because they were comprised of real estate loans from different parts of the country — so if Florida real estate went south, the investments would benefit from rising prices in Arizona. If things got real tough, the Fed would lower interest rates.

But the Lehman collapse sparked a panic that quickly spread to the remaining players: Goldman Sachs, Morgan Stanley, Citigroup, Bank of America, etc., which held so much of these now-money-losing investments that the entire financial system was insolvent. They were supposed to be insured by fancy financial products developed by American International Group. But AIG was basically insolvent as well and didn’t have the capital to cover all the losses.

And with that, the bailouts began. The remaining banks survived, so a Great Depression was averted, replaced by a Great Recession instead when banks became stingier with their cash, businesses folded and unemployment shot up.

Unfortunately, policymakers still haven’t learned from past mistakes. In 1999, President Bill Clinton and Republicans in Congress passed a law that allowed big banks that hold deposits to fully merge with risk-taking Wall Street firms. The law put a stake through one of the most logical regulations ever passed — a Depression-era law called Glass-Steagall, which essentially said Wall Street firms can roll the dice all they want but the government isn’t going to allow these activities to infect commercial banks, which hold deposits that are insured by taxpayers.

Amid the irrational exuberance of the boom years of the 1990s, the Berlin Wall that was Glass-Steagall came down. The ensuing finance behemoths set the stage for the crash and the massive bailouts of 2008, and more regulation.

Yet Glass-Steagall was never re-enacted. Banks like Citigroup, Bank of America and even JP Morgan — albeit the best-run bank in the country — have their Wall Street risk-taking and FDIC-insured banking deposits for average people under one roof. Which means if the Wall Street side of the equation blows up the bank, taxpayers are still on the hook to pay off those insured deposits, as in 2008.

Plus, the banking system has its risks more concentrated than ever because a greater percentage of assets are held by fewer players than in 2008. Contagion will spread faster.

Meanwhile, there are new, so-called nonbank players emerging that fall between the cracks of federal regulations. Money manager Blackrock holds more than $6 trillion in assets — more than JP Morgan, which has more than any other US bank.

Private equity firms are growing as well, but government scrutiny of them isn’t. If history is any guide, when the PE shops and Blackrock get into serious trouble, they’ll be deemed Too Big To Fail.

Lather, rinse, repeat.

Charles Gasparino is a Fox Business senior correspondent.