leavening agents create air bubbles in the batter, which is what causes the bread to rise. baking sets these air bubbles so they remain in the finished product. but if the banana bread is not done in the middle, the structure doesn't set properly. that's often why banana bread collapses when cooling.