Create local table and foreign table from the same SQL
I think I'd try to get a list of tables from the .sql file (or directly from the server to which you applied the .sql file), then feed that list of names to IMPORT FOREIGN SCHEMA ... LIMIT TO (...).  That seems less error prone than what you are envisioning.