Why is discrimination based on citizenship allowed in PhD funding in the UK?
I wrote a pretty extensive response on this a little while ago: here and also this may be slightly relevant. 

The short version is: Because they can be, and because they have to be. UK universities make money off international students; their funding is limited, and it is designed to go to domestic or European students. The funding bodies will only fund domestics because a) they're probably not allowed to fund anyone else; b) it's in their best interests to fund domestics; c) one international PhD scholarship would be equal to 2 or 3 domestic ones.

There is also the over-arching idea in the UK governmental system that students are supposed to bring in money, not take it. This idea has spiked in magnitude in the past few years.

The UK government limits the funding given to universities, and universities make up for that with international fees. We are essentially cash cows, outside the rare scholarships that are extremely competitive (Rhodes, Fullbright - the second of which neither of us is eligible for).

You also can't go for the option of naturalisation based on the time you've been in the country because -- you guessed it -- time as a student doesn't count.

Source: Same situation as you, left friends, home, and partner to do PhD in France after 5 years in Britain. I had many PhD acceptances, but none of the universities could fund me and we spent months looking at every option. Unless you're rich and you can self-fund (or you're happy to take out loans), it's unfortunately not very doable right now.

You should also keep in mind that, as a student at the end of your education, you are unfortunately likely to be targeted by the immigration police. I would advise you to not do anything like overstay, but also to not leave the UK once you have graduated until you're ready to move away before the expiry of your tier 4 visa -- because you will not be allowed back in even if your visa has months of validity on it. It happened to me. This is unrelated to your question, but it's a warning I think not enough people in our situation get.