As @a brody has already mentioned, macOS will on boot on hardware that the particular OS is compatible.
If a Mac ships from the factory with macOS 10.15 Catalina, then it cannot run macOS 10.14 Mojave. There is one small exception though. If a Mac model existed prior to the release of lets say Catalina in this example, then that particular model can still run the previous OS Mojave. It only pertains to that one very specific model. If a new model was released at the same time as Catalina (or a model is released after), then the oldest supported version of macOS is Catalina.
A perfect example of this is the MacBook Pro 13" (2019) model which according to MacTracker was released in July 2019 running macOS 10.14.5 (18F2058) Mojave. This model was not discontinued until May 2020. All computers for this model series sold after Catalina was launched in October 2019 would ship with macOS 10.15 Catalina, but a user could downgrade the OS to macOS 10.14.5 (build 18F2058)+ Mojave if they wished.
However, the new (at the time) MacBook Pro 16" (2019) model first released in November 2019 cannot be downgraded to Mojave since this specific model did not exists prior to the launch of Catalina. The lowest version of macOS supported for the MacBook Pro 16" (2019) model is macOS 10.15.1 with build 19B2093.
This has been the way Apple has worked for decades....as far back as I can recall...even to the PPC days and the pre-OSX days.
If your Mac falls into the gray area that I mentioned, then that is why your "trick" works. Once reason installing Mojave directly does not work is if you are using an older version of the Mojave installer that pre-dates the release of your Mac model since all Macs have a specific minimum version of macOS that must be met which includes the minor patch level and even the actual build number of the OS.
Unfortunately you neglected to mention the exact model of your Mac where you say you are using Mojave. You can get the exact model of the Mac by clicking the Apple menu and selecting "About This Mac".