Were X and the deceased married (or in civil partnership), or thin king of getting married (or entering a civil partnership) at the time the will was made?
If so, then the appointment of X would “fail” should they have divorced or the civil partnership was dissolved before the death of the deceased.
As the Non-Contentious Probate Rules specifically provide for where a named executor loses capacity, I think it is stretching to suggest that loss of capacity causes the appointment to “fail”.
I consider that Rule 35 of the Non-Contentious Probate Rules 1987 will be engaged, and it will be necessary to liaise with the Court of Protection for the appointment of a nominee to obtain a grant or, if there is an attorney under an LPA or and EPA, for authority for that attorney to apply for the grant.