First off the building boom was caused by greed among the countries elite, mostly linked to the right wing PP party. They used corruption at local level to grant illegal planning permissions or by-pass/ignore them all together. Then they used local caja's (savings banks) to fund the building boom. The trick was here, that most caja's were historically linked to the church or political parties. These caja's were often except from banking regulations that the big banks were forced to follow, but stood for a majority of the lending and the deposits. That is why Bankia was such a problem. It was a merger of 8 problem caja's, with the biggest (and oldest bank in the world), Caja de Madrid being the biggest problem. Caja de Madrid was/is the PP party's (currently in government) bank, and court documents in corruption cases clearly show that the PP party in Madrid used the bank as a personal ATM for pet building projects.
Had the caja's followed the banking regulations in Spain, the same regulations that the Banco Santander and BBVA followed, then they would never have gotten into trouble. Had the local planning laws been followed then the building boom would not have been so massive. Had the politicians acted on what they admitted was happening, then Spain would not have gotten into the hole they are in at the moment. But as always, the politicians either were corrupt (both legally and morally) or did not have the balls to stand up to the system. Even today, the present PP government is still corrupt, with cases involving the Prime Minster himself coming out, and they were elected in with a massive majority, despite being responsible for most of the problems. But hey they are forcing their new abortion bill down on the people, a very unpopular change. Sadly there wont be elections for a few more years, but the PP at them moment would stand to loose over 1/3 of their seats.
Now saying this, there is a lot of stupid regulations in Spain (and France and Italy) and that has been put in place to protect local industries and go back to before the EU was around. Getting rid of these regulations should be priority nr. 1 for those countries, but it aint because of the local politics involving industries and unions who conspire to keep the regulations in place to keep their stranglehold on power.
But it is not only in these countries, but in all countries to a certain degree. In the UK planning laws are more crazy than in Spain, or car dealerships in the US preventing competition. Every country has its problems that it often refuses to deal with.