Aren't you guaranteed "foundation years" and not residency? From my understanding, to be a general practitioner, you're required to do 3 years of specialist training after the foundation years and that's when the whole citizenship problem comes in i believe. I don't think you can be a practicing doctor without doing the specialist training.
I'd love to know more though. Any input would be appreciated.