How can I convert TileMapPattern changes in code to permanent project changes in the editor?

I’ve started the process of converting my game form Godot 3.5 to 4, and unfortunately that process completely wipes my levels which had been built using the old AutoTile system. From reading the documentation surrounding Godot 4’s TileMapPattern, I’m fairly confident that if I just recreate the Tileset I can export all the tilemap data from the old project and import it into the new project in code.

The problem is I’d like these levels to be one time, permanent imports, and not have to perform the intake on every gamer start. Is there any way I can make changes to nodes during the game’s runtime that persist after closure into the editor?

Look into @tool scripts: Running code in the editor — Godot Engine (stable) documentation in English

It runs in the editor instead of the game. If a tool script makes changes to a scene you can just save the modified scene in the editor.

You can also use EditorScript to run a one-time job, as described in this article.