Worker routes remain, even after domain has been removed from account

Issue:
Worker routes remain after the domain is no longer associated with the account anymore.

Steps to reproduce:

  • Add worker route to a domain
  • Remove domain from account
  • Go to worker, click on “routes” and you will see that the removed domain is still there

BTW:
The worker routes are still there months after the domains have expired / been removed from the account.

Suggested solution:
Create an async hook after a domain has been removed, and delete any matching worker routes from the account.