Banks, and in the last decade private lenders.
The simple answer is "because they're generally good for it." No one would invest if these companies immediately went bankrupt.
First.. lenders generally get a premium if it's a risky deal. Low risk rates are exceptionally low. There's always some demand for higher yield bonds. Supply and demand are generally unresponsive to eachother. In the current market,
Second, think "bondholders" moreso than lenders. The people who structure the deal are the initial financiers, including the PE firm. They just borrow/invest enough to ensure solvency in the first few years. Long term, bonds trade. They trade at market rates.
Also note that all these bankruptcies happened during the dotcom bust, regardless of when Bain got involved. At that point, demand for risky bonds is terrible. Business is hard, and a highly leveraged company is at risk. Highly leveraged companies tend to stay highly leveraged, so even if Bain did this to them 15 year prior... it's hard to survive bad times.
People who understand business from a purely SV/tech perspective forget that software is not normal. Outside of software, large companies usually owe money. They don't have billions of dollars lying around like FB or Google.