The housing bubble existed because numerous lenders were making loans without any consideration of whether or not people obtaining those loans actually had the ability to repay them. The idea was that perpetual home price increases combined with perpetual opportunities to refinance would just keep the party going forever.
I know that it's fashionable to believe that nobody could've predicted that this would come to a halt at some point, but you don't have to be all that smart to see a little flaw in that model.