How to handle thounds of routes with dynamic gateway address in main routing table?

I put more than 4000 routes of which the gateway address is got from PPPOE into the “main” routing table. As a result, I have to update more then 4000 routes everytime when the pppoe address is changed. Is there any solution to avoid this happening? Thank you.

The background is the access to ip in my country is throuth the 4000 routes, the access to other countries in the world is through several vpn tunnels. I have tried below:
1、Use address list and mangle table to mark routing, but the cpu load is relatively high for matching 4000 addresses frequently.
2、Use 4000 routing rules instead of routes,such as /routing rule add action=lookup table=xxtable dst-address=x.x.x.x. I really wonder is this a perfect solution.

Try using pppoe-interface as gateway, instead of the IP address.

Will this cause unnecessary flooding?

why would it be any different from using the IP address?
Also you can add routes dynamically through the PPP/profile configuration, so for instance if you set 1.1.1.1 as the destination on the ppp/profile section on the client, each time it connects to the server using this profile it will automatically add a route for that destination going through that client interface.
Same thing can be done on the server side, not realy needed to be done for your situation but though it would be good to share

Setting next hop to interface or ip address is different. https://community.cisco.com/t5/networking-knowledge-base/static-routes-with-next-hop-as-an-exit-interface-or-an-ip/ta-p/3146984
For PPP/profile configuration, I am not sure how to do exactly. Could you tell me more?