Most numbers I can find via quick googling seems to put the median annual salary for a SWE in the US at around €75-78k and €55k in Germany. That is pretty close to the 25% number you quoted.
For me, I can say I didn't consider salary when choosing my field. It's just not a common concern, you're expected to study something you're good at and would enjoy doing. Medical and law were definitely not even remote thoughts for me.
It was a happy accident that software engineers are paid so well (relatively). I suppose I just assumed all MSc fields are roughly equal and quite acceptable as far as salary goes.
The US is very individualistic in comparison, and in my opinion it is not doing well in this regard. Things like crime, violence etc all increase when people are pushed into poverty.
Wealth should not be the absolute measure of a person in society, because that would mean the market would decide the value a person brings to society, which is the wrong take on things in my opinion. Mainly because not everything should be handled by the free market. (healthcare for instance, should not be dictated by market forces).
Median incomes in Germany are about 25% lower than the US. Yet SWE compensation seems to be 50%+ lower than the US equivalent. That would suggest that other skilled professions must make significantly more than SWEs.
For example in the US, bankers or lawyers are roughly on par with high-end SWEs. I'm would assume German bankers and lawyers are making well more than 60k. If that's the case, what incentive would talented Germans have to pursue software instead of other higher-paid careers? (I could be wrong on my assumptions, maybe skilled professionals in Germany are just much less compensated relative to the median worker in general.)