Now thinking about syntax if I do write my own tool. It should probably trigger a syntax error so we don't end up with a missing module.
Then a relatively simple script can find all of those lines and replace them with the file contents.
What I ended up doing was building a zipapp, a ZIP archive containing Python scripts. There's a module (zipapp) for building them, and you can use a shebang to make them act like executables.
Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.