You can use Terminal to download the installer for macOS versions that are no older than the version that the Mac you’re currently using shipped with, or the closest version still available.
Open Terminal and type in the following command to see which installers are available to download
softwareupdate --list-full-installers
This will list all available installers – take note of the version number as that’s the key to download the relevant installer. Still in Terminal, type in:
softwareupdate --fetch-full-installer --full-installer-version <number>
where <number> is the version number from the first command, e.g.:
softwareupdate --fetch-full-installer --full-installer-version 15.7.2
This will download and install the Install macOS Sequoia app into your /Applications folder.
To build a bootable macOS installer, you can then run createinstallmedia as follows to build a bootable USB installer.
sudo /Applications/Install\ macOS\ Sequoia.app/Contents/Resources/createinstallmedia --volume /Volumes/Install\ macOS\ Sequoia --downloadassets --nointeraction
Be careful with the --nointeraction flag – it will format whichever volume you have passed to the createinstallmedia without any further warning, permanently erasing all data on it before overwriting it with a new macOS installer.
I’ve got a Samsung T7 external NVMe SSD with a bunch of extra partitions on it, and I carry around the past 6-7 full macOS installers, and they’re all bootable. I used Disk Utility to create a number of 20 GB partitions on the drive for each macOS installer and then formatted the rest as an APFS data partition.