For that, it should be sufficient to use the automatic failover based on recursive next-hop search. With this in place, Anydesk/TeamViewer/whatever software will re-establish the connection to the cloud once the primary WAN fails, and it will also re-establish the connection via the primary WAN again once it recovers (unless it uses UDP, as that would require additional measures).