First I copy some audio from an Audacity track (usually some seconds of silence with a sound at the end), close the track so that the project is empty or simply open a new project, and apply the above macro to a batch of files. This normalizes the selected files, pastes the copied audio to the end, and exports as mp3s. At least since Audacity 3.0.3 the copied audio is not appended anymore - i.e. the files are exported without the previously copied audio added. I have returned to Audacity 2.4.2 where the macro is working again.
Right now this is working fine for me, but at some point I would like to upgrade to the latest version of Audacity again.
A workaround is to export the audio that you want to append as an audio file (for perfect quality, use “WAV 32-bit float”), then import that file each time you want to use it with “Import2:”
I’ll close this topic as “solved”, not because the bug is fixed (it isn’t yet, but it is logged for fixing), but because it offers a usable workaround for anyone else that encounters this problem.