The only thing that counts for eligibility is whether or not you 'ordinarily live' in the UK.
“Ordinarily resident” is
During my working life I've spent many periods of time working outside of UK for longer than 3 months.living lawfully in the United Kingdom voluntarily and for settled purposes as part of the regular order of their life for the time being, with an identifiable purpose for their residence here which has a sufficient degree of continuity to be properly described as settled.
On those rare times I needed any kind of NHS treatments I didn't need to prove residence simply because I wasn't asked.
These days I believe the NHS is much wiser in checking eligibility, which in principle has nothing to do with nationality or past payments of NI of taxes of any kind.
I'll have to take time out and see whatever happened to the government ideas of free NHS for UK overseas retirees.
I know there was something about having a continuous 10 year record of NI payments at some time during the working life.
Like all other good ideas probably still buried somewhere