Need help to setup failover config

I’ve got two ISPs:
ISP#1 - via Cable and L2TP connection.
ISP#2 - via PPPoE ADSL connection.
I’m trying to setup a failover configuration with ISP#2 activated only when ISP#1 cable fails.

I wrote a script that enables ISP#2 PPPoE connection when L2TP to ISP#1 fails to connect (like cable failure etc.).
It is possible to connect with the same L2TP connection to ISP#1 from the Internet (and through PPPoE of ISP#2 as well).I can’t disable L2TP for some reason. So I have L2TP running over PPPoE.
The problem appears when ISP#1 screws up completely and no traffic is able to go through L2TP despite it stays connected (through PPPoE of ISP#2). In this case traffic is not routed through PPPoE, it is stuck with L2TP.

I need to route all traffic through PPPoE of ISP#2 when it is connected regardless of L2TP state.
What is the most appropriate way to do that?

I suppose I can’t do that through OSPF because I receive all IP settings dynamically. Please correct me if I’m wrong.

When it is “stuck”, what happens if you disable the L2TP on the mikrotik and then re-enable it. Does that fix it? If so, just write a script that does just that.

If i disable and re-enable L2TP and my ISP’s L2TP server still doesn’t allow traffic to go through it, my router still tries to route all traffic through L2TP. Why doesn’t it just route all traffic through PPPoE in the case of L2TP not passing any traffic ?

The question is how to give a PPPoE connection higher priority than L2TP ?

The priority is the default route… whatever you have that set as. Note that you can write scripts to enable or disable PPPoE connections as well. If you want to completely disable the #1 PPPoE, you can do that.

Default routes are added dynamically for both connections L2TP and PPPoE. Only one of them is “Active”.
Both have the same “Distance” of 1 which I don’t know how to set manually.
L2TP becomes active but no traffic can go through it due to problems on ISP servers.
How can I make a default route active for the needed connection (PPPoE) ?