The Orthodox, Old Catholics and sspx are actually within the confines of the Church. I know that the Church does not question the validity of their Eucharistic liturgies though I do think it interesting that the Orthodox do not generally allow Catholics to participate in the reception of the Eucharist since it implies a oneness in faith that they, at least, do not believe to exist.
Once there was the question raised of an apostate priest who would preside at a “black mass” to consecrate the bread and wine in order to blaspheme against Our Lord Jesus. My position was/is that regardless of the fact that the priest is a true priest, doing such a thing is outside of what the Church intends and would thus not be valid (I was also curious which Eucharistic Prayer one would use at a black mass

). Others disagreed but I remain steadfast in my opinion. I do not believe that the Holy Spirit is held to some legal, technical mumbo jumbo that weighs upon the question of validity. I think that if a priest were to defect to an ecclesial community, then his intention to do what the Church intends is in serious doubt, since the intention of the Church is to consecrate bread and wine
as part of the Church, in union with the pope and his bishop, fellow priests and the Church as a whole.
However, this is just my personal conjecture and opinion so you’ll get from it what you paid for it!