One name that would work for this fallacy is "affirming the consequent" although we are doing it twice.
The Internet Encyclopedia of Philosophy defines this fallacy as:
If you have enough evidence to affirm the consequent of a conditional
and then suppose that as a result you have sufficient reason for
affirming the antecedent, your reasoning contains the Fallacy of
Affirming the Consequent.
To see how this might be an appropriate name consider the situation.
If p, then q. If q, then r. Therefore, if r, then p.
When one assumes r hoping to derive p in the above example, one could interpret that as using the fallacy of affirming the consequent twice.
First we firm the consequent, r, to obtain the antecedent q given the conditional, "if q then r".
Second, q is the consequent of "if p then q". By using the fallacy of affirming the consequent again, we may try to obtain p as a result.
These two uses of the fallacy of affirming the consequent give us the formally fallacious result desired.
Bradley Dowden, "Fallacies" Internet Encyclopedia of Philosophy. <https://www.iep.utm.edu/fallacy/>