Currently, your router monitors WAN connections only on layer 1, i.e. if a link is up or down. In order to react to a broken WAN connection, your router should monitor on a higher layer.
There are 3 approaches:
a) You use a router with two interface directly conntected to the splitter or telephone jack. Your router could still be monitoring a WAN link on layer 1. But your router would dial up via PPPoA. You could monitor both the line and the registration of your router by each ISP's RADIUS or TACACS server. Either your DSL line is run by a protocol such as ADSL2+ and authentication is done by user/password or by a protocol such as VDSL2 and authentication is done by modem MAC address. In case of user/password all you need are login credentials. In case of MAC address you have to personally negiotiate the registration of your router with both ISPs.
b) Your router dials up via PPPoE without the need of using new WAN interfaces. This would allow you to monitor each WAN connection on layer 2 which is sufficient enough. Your router would become the gateway and you could reduce the modems to managing DSL lines. This requires both modems to run a firmware supporting dialup by another device.
c) Your router monitors by probing a host on the WAN. Usually, there is at least one core router. which replies to ICMP Echo. Try
traceroute -I 18.104.22.168 with both connections. It changes the
Type of Service field to request Echo-Reply messages from each hop during the trace. You should at least find one core router for each ISP which you can probe on a regular basis. Then, you have to reduce the TTL of that ping to prevent reaching that destination on detours when the monitored WAN link fails.