The only time you’re locked to an OS release is if your hardware can no longer support it. In the case of Apple hardware, that tends to be five or six or even seven years after that particular hardware was last sold. And even then you may still get the odd security update for a few years after that.
My 2015 MacBook Pro is currently running Mojave (by choice). I can upgrade to a newer macOS whenever I want, but because this hardware is a decade old I can only upgrade up to Monterey. I cannot upgrade to Tahoe, I would need a newer computer.