Barcelona is also a very walkable city (across the entire area of 2 million people, not just the very center) and is definitely the upper end of Spanish income.
A big part of this is long term cultural: medieval towns (and even much older) were all clustered very tightly into blocks with city walls against attacks, those slowly evolved into the vast majority of the towns & villages in Spain today, and have left a culture where flats and dense city centers are the expected norm and the primary model, even for towns surrounded by empty space. You can easily find small towns of apartment blocks and tight wall to wall houses in windy city centers, of just 1000 people, surrounded by fields for miles.
The Spanish would argue that surburanism is generally less enjoyable (walkability, community, socialability) and less secure (houses are easier to rob than non-ground floor flats) while dense apartment/etc living is better value (less land cost, shared maintainence in apartment blocks) and provides better airflow/heat management & opportunity for balcony views (attic flats etc).
A big part of this is long term cultural: medieval towns (and even much older) were all clustered very tightly into blocks with city walls against attacks, those slowly evolved into the vast majority of the towns & villages in Spain today, and have left a culture where flats and dense city centers are the expected norm and the primary model, even for towns surrounded by empty space. You can easily find small towns of apartment blocks and tight wall to wall houses in windy city centers, of just 1000 people, surrounded by fields for miles.
The Spanish would argue that surburanism is generally less enjoyable (walkability, community, socialability) and less secure (houses are easier to rob than non-ground floor flats) while dense apartment/etc living is better value (less land cost, shared maintainence in apartment blocks) and provides better airflow/heat management & opportunity for balcony views (attic flats etc).