Tier 2 visa extension
Short answer: Yes, applying for a Tier 4 visa sounds like the right decision in the circumstance, based on my own experience.
I experienced a similar situation in 2018 when I had to move from the UK to my second institution in Italy. There was a delay in completion of my Italian contract and my Tier 2 visa was approaching its expiration. I complained to the international office in my University (in Scotland, UK) and I was told it was perfectly ok to switch from Tier 2 to Tier 4 as I was a full time student and had not completed the degree. I applied for a CAS and this was signed off by my PhD supervisor. I successfully applied for a 2-months' Tier 4 visa via the International office and it was granted by the Home Office (plus the usual additional 4 months). Following the same process, I applied again for an extension of this visa as I was yet to complete my 3rd year of PhD, because I was moving from Italy to Scotland regularly, for my research work. The extension was also granted. I completed the PhD, did my viva in the UK and applied for a Tie 4 doctoral extension visa, which was also granted.
For you I expect that it would be straightforward. Apply to switch to a Tier 4 visa. (You may need ATAS...check). I am confident that it would be granted. At the end of your PhD you should qualify for the new post study visa for Tier 4 students too or return to a Tier 2 visa if you are able to get a job with employers that provide Tier 2 sponsorship.
I hope this helps.