It's for the addresses (maybe)
"I can't see that medical records and tax liability are sufficiently closely correlated to make the exercise worthwhile."
I don't think it's the medical records that are of interest, but people's addresses. Under new income tax arrangements, Scottish residents will pay income tax to Scotland. I'm guessing the NHS register is considered the most accurate database linking people to their current address.