Update: I think this issue with some untracked files *may have been the problem.
I removed the files and made sure that the command git checkout main succeeded.
Then I ran ./launcher rebuild app and it seems to have worked.
AFAICT, as per what @Falco states above, I don’t think it is actually necessary to track main in the Discourse repo. When you run ./launcher rebuild app the script itself will check out the correct branch.