As a system the NHS needs massive reform. I think things may have tightened up recently but it was an absolute free for all for so many years without correctly recharging other countries for treating their citizens.
When I was in Spain a few years ago and my son, who was a baby at the time came out in a rash all over his body and needed medical attention the first thing we were asked for was our E111 cards before they would treat him (rightly so imo)
This is how the other countries in the EU have operated for years - recharging the costs back to the home country of the citizen but we have never really implemented this properly in the UK (or at least we hadn’t for a very long time). Whether this was down to incompetence/ lazyness I have no idea