Cleaning up my build script
Most of the time the simplest tool is good enough. I keep relearning this, which is exactly why it goes here. The documentation was correct, I just did not read it carefully.
The fix turned out to be one line, after an hour of looking in the wrong place. Writing a tiny test first made the problem obvious.
After cleaning things up, the whole thing runs noticeably faster. There is probably a better way, but this one is easy to remember.
Naming things clearly helped more than any clever trick. Next time I will start with the boring solution and see if it is enough.
I wish someone had told me this when I started. Measuring before changing anything saved me from a pointless rewrite. It is worth writing down the commands you only need twice a year. Plain text keeps winning for small personal projects.