See T122261: Come up with scenarios for deletion/undeletion of Flow boards and figure out how to handle them and T117812: Fix en:Wikipedia_talk:Flow/Developer_test_page.
This task is the actual implementation to fix issues found in T122261: Come up with scenarios for deletion/undeletion of Flow boards and figure out how to handle them.
See T148057: Fix user talk pages already in inconsistent state due to to T138310 since the same script may be useful (once written).