Generally speaking this is not reversible. Many phones specifically blow fuses in the device to make sure that attempts to downgrade will fail for security reasons. They don’t want someone stealing the phone and somehow tricking it into downgrading in order to extract its content using a security vulnerability that existed in an earlier version.
With that said, if you can get your hands on the ROM Or at least one of the version you require, you could unlock the device and flash whatever you want. You may not be able to re-lock the boot loader however for the aforementioned reason. If you can that would be a device-specific thing.
It looks like older stock firmwares are available online by unofficial sources. You can decide if you trust those enough to attempt to downgrade.
Reference: https://xdaforums.com/t/guide-bootloader-unlock-for-moto-g-stylus-5g-2023.4620535/