wow, this is a real shocker. A person who really needs to sell and is acting in good faith is prevented from getting vacant possession of the house. I would accept that the RAS scheme should have strong protections for tenants alright but there surely should be a proper balance. Perhaps to include a reasonable period of time to allow the tenant source another house for example.
More generally my understanding of the RAS scheme is that it is not attractive, in fact it's extremely unattractive. While there are upsides in terms of certainty of rent, there are very significant downsides. These include the fact that the house owner is (more or less) handing the house over to the local authority and has limited say in who is put in the house. The initial tenant is usually agreed to by the house owner but if that tenant leaves the house is under rent to the local authority who can put another tenant in the house, with no approval allowed by the house owner. Yet the house owner is responsible for any anti social activity. Any damage is for the owner to pay, the local authority disown any responsibility.
I also believe that the RAS scheme is not particularly in the best long terms interests of tenants either, due to the fact that so few owners take it up. If it were a much better scheme with a proper set of rights and responsibilities on all sides (owner, tenant and local authority) and it was fairer to all you might find that a lot more owners may take the scheme up. There are some very positive aspects to it, particularly certainty of rent. It would also lead to general improvements in the quality of accommodation available as the local authority usually inspects and requires accommodation be maintained to a proper standard. Benefits all around.
Regarding the situation posted, all I can advise is to talk to the various parties to see if a solution is possible. Sounds like you already have had legal advice so a compromise is required, if possible.
Finally, not judging, but once again it beggars belief that people sign agreements with long term implications without reading them.