To be precise, Spanish Flu didn’t attack the immune system (any more than any infection does, that is) — the “inexperienced” immune system of a young person who was infected overly aggressively attacked the person to try to purge the virus, causing many complications that often lead to death, including organ failure.
It is why it had a bimodal mortality rate (mortality was high in people younger than 5 years old, 20-40 years old, and 65 years and older) and why it flummoxed medical professionals at the time, as they had a fairly rudimentary understanding of normal immune response. It also killed so many people partly due to the timing of the outbreak (WWI).
But it is very important to note that we really don’t know if COVID-19 actually doesn’t impact younger people as much as the old/infirm (who are always an at-risk population for these types of viral infections). The data is far, far too limited to make such conclusions.
And we don’t yet know it’s impact on all age and health quality cohorts by economic strata and healthcare access. It could very well have substantial impacts on younger populations in certain regions.
It is also worth offering another reminder that the current confirmed numbers are all but certain to be much lower than actual numbers, both due to the natural limitations of early data collection (real assessment can’t really take place until after an outbreak cycles finishes) and artificial constraints to reporting and assessment (China restricting data access and/or suppressing reporting and Iran not having the systems or expertise to accurately report).