Yes, this was a private hospital it seems (I just checked). I went where I was instructed by my travel safety program / travel insurance, which ended up reimbursing most of my costs involved anyway. It was selected because it was the only hospital in the area with a foreigner's department.
My experience may not have been representative then, as it could have gone differently in a public hospital, but I am unsure. It seemed based on what I was told at the time that I could only seek treatment at hospitals that accept foreigners except in the case of an emergency severe enough to require an ambulance (I called an Uber to take me). I think any hospital would have ensured I was stable but not admitted me for multiple days of care other than one with a foreigner's department. But, it may be that a public hospital would have treated me without any concerns about my citizenship or residency.
I'm glad to hear you've recovered most of the money. Yes, I also think you would've been treated and hospitalised anyway. I don't think (but I may be wrong) that hospitals in Spain have a "foreigner's deparment". That may go against some EU laws.
Nearly every country I visited in Europe had defined foreigner's departments in the hospitals (but not in all hospitals). The entire purpose of those departments was to work with people who did not reside there and likely did not speak the language. For instance, in the case of the foreigners department in Spain, they had translators on staff during the day for communicating with specialists or the doctors as well as English speaking nurses during the day, which was not guaranteed in other parts of the hospital.
In some countries I visited the foreigner's department was more involved in handling currency exchange and payment details, but less concerned with care or providing services (Czech Republic was this way at FN Motol for instance: https://www.fnmotol.cz/en/samoplatci/).
If you are a resident citizen of an EU country, you can often seek treatment in other EU countries under the same social medicine scheme they have and your citizenship/residency paperwork covers you. I'm not sure if Country A bills Country B or how that works exactly, but it was pretty clear that the foreigner's department concept was for non-EU citizens who were private pay and ineligible for social medicine.
My experience may not have been representative then, as it could have gone differently in a public hospital, but I am unsure. It seemed based on what I was told at the time that I could only seek treatment at hospitals that accept foreigners except in the case of an emergency severe enough to require an ambulance (I called an Uber to take me). I think any hospital would have ensured I was stable but not admitted me for multiple days of care other than one with a foreigner's department. But, it may be that a public hospital would have treated me without any concerns about my citizenship or residency.