Your description is a bit vague with regard to the setup in place: how does the "switch failover" situation affects your server's net device ? loss of link ? mere interruption of packet forwarding ? some kind of explicit notification such as an LACP might do ? or what else ?
Also, which interfaces have you got in
allow-hotplug ? the physical device ? or the vlan interface ? or both ?
The thing is, the described behavior does not really make sense according to the described setup alone. For instance, the mere loss of link usually does not suffice to delete routes, nor to set interfaces down, unless there is some additional setup in place that does so explicitly.
I would also say that this additional yet unmentioned setup cannot be a standard
netplugd, which act on link events (such as cable plugged/unplugged), because these typically invoke
ifdown on those events, and thus your
post-up command would be executed when the link would come back up, if their configuration is consistent with your vlan interface.
Note that the ifupdown's
allow-hotplug setting relates to device hotplug, not cable hotplug, meaning that it acts basically only at boot-time (i.e. when the kernel detects the device presence for the first time) and/or if your net device is e.g. an USB dongle and you plug/unplug it to/from a USB port of your server.
I would therefore suggest that there is some custom service, running on your server, that possibly detects loss of networking through some probe, maybe a periodic
ping or a TCP connection established on purpose, that deletes your route as soon as it detects the loss of networking, but does not add it back when that probe connection comes back alive.
To answer your specific question:
How can I configure an interface to restore routes to networks that where lost, but, to quote the old song, have now been found?
It depends on what it means to your application having "lost network connection" and thus what it means having it back. If the interface link state is enough then you can really just rely on either
netplugd or equivalent (whichever you prefer or best fits your requirements): your
post-up command is enough if associated to an "ifupdown" vlan interface that is simply always existent on top of its master device or that is configured to follows its master's fate.