Over the past decade, Fannie Mae and Freddie Mac transformed themselves into some of the worst-run companies in recent history. But contrary to current talking points, the firms’ failings had almost nothing to do with their programs for low-income borrowers. As policymakers debate what should be done with the mortgage giants, a battle is now beginning in which the very availability of affordable housing for the middle class may be at stake.