Enter rolling distributions, where each upgrade is guaranteed to work. Even if you can't upgrade from version A to C, you can upgrade from A to B to C. Why can't Microsoft products also upgrade this way, even between major versions?
Except you can see Youtube videos of examples where people started on early versions of DOS in a VM and upgraded all the way to Windows 10. Name one company that does more work to ensure backwards compatibility. You can even read Raymond Chen's blog about times where Microsoft developers wrote shims to emulate bugs in previous versions so that specific applications would continue to work.
And no, Microsoft can't guarantee everything developed by a 3rd party will continue working, and nor should they.
The bottom line when it comes to places like the NHS is that they decided to cut costs by either not entering into a custom support agreement with Microsoft so that they could continue to get security patches for XP, or by upgrading their systems to run on newer versions of the OS.