This is because a lot of older devices are still in use, but Apple didn't make the newer OS available on them.
People are keeping their old devices longer, and discontinuing new OS on old devices no longer "pushes" people to new devices like it used to.
This creates an awkward situation. Due to the large market share, Apple ends up being "forced" to fix security vulnerabilities on the old versions.
Currently, Apple is releasing updates for 5 major versions of iOS/iPadOS: 15, 16, 17, 18, and 26. Even iOS 12 was supported for nearly 5 years!