With an Intel Mac, then boot into Internet Recovery Mode using Command + Option + R to access the online macOS installer. It is best to connect the Mac directly to the router using an Ethernet cable for a faster more reliable connection which also bypasses any hard to troubleshoot WiFi issues.
If it is a 2019+ model, then you can perform a firmware "Restore" which will reset the T2 security chip & firmware which will destroy all data on the internal SSD and prepare the internal SSD for macOS. Then you will need to boot into Internet Recovery Mode to reinstall macOS since the "Restore" may not push a clean copy of macOS onto the internal SSD. Usually for the Intel Macs you will only need the firmware "Restore" if installing macOS fails.
Otherwise you will need to find another Mac which is compatible with the OS you are trying to install so you can download & create the bootable USB installer using the instructions in this Apple article:
Create a bootable installer for macOS - Apple Support
I agree it is pathetic that Apple makes this process so difficult and requires very specific systems just to access the installers. Even when Apple provides an official download outside of the App Store, it still requires a compatible Mac to extract the real installer from the downloaded file. I don't see Apple changing this especially since with the Apple Silicon Macs Apple prefers either Recovery Mode or DFU Mode to Restore the OS.
FYI, even if you can download an older macOS installer, you won't be able to use an Apple Silicon Mac to create a bootable USB installer for anything other than macOS 11.x+ since the older installers are not Universal Binaries.
[Edited by Moderator]