That's the issue, only flagships. All the more affordable and mainstream models don't get any meaningful software support.
Apple has some horrific practices that I don't agree with when it comes to repairability, but at least it treats its products the same way. The iPhone SE from 2016 still runs the latest iOS version, same for iPhone 7.