Well, you're mixing 2 things here: Apple's tooling support for older versions of iOS, and what developers choose to do.
Today, you can create a new app in Xcode, choose "iOS 15" as the minimum deployment version for your project, and you'll have an app that runs on devices going back to the iPhone 6S/first generation iPhone SE.
Even supporting back to iOS versions prior to that is fairly straightforward (you'll just have to edit a plist by hand rather than use the UI picker if creating a new project) - I have some older iOS 9 projects that still compile without any issues (just tested for the sake of this comment).
But to your issue of most apps not working on an iPhone 7 - that's because many developers will choose to only support iOS 16/17 or later (and the iPhone 7, a 9 year old device, stops at iOS 15). That's their choice though, not a failing of Apple's tooling.