Everything you mentioned is a laptop? If you get a MacMini you can save some money. You are right to consider the longevity of the machine. As a developer for iOS you will always be battling the last OS, Count on your development machine and iOS to release a major update once per year.
I'd say the service life of a computer as an end user can be several years, 5-7. I think as a developer, about 4 years would be my quick educated guess. If you are releasing apps you are going to have to keep up with the latests and greatest as that is what your users will expect. Right now if a machine will run Sierra 10.12.xx, and Xcode 8.2, you will be fine, how long, the question you are asking, is not set in stone, If it were me, I wouldn't go beyond 2012. If you find anything earlier it may hold you for a year. So you can determine your ROI from there. If you can produce, or learn what you want before the next upgrade great. But easily within two years you will be buying again.
You are probably looking for a hard fast answer. But the reason you found different answers is Apple has changed the upgrade path and shortened it as of late. It will also matter what processors are available, sometimes the path ends when there is a major processor change.
I had a 2011 Powerbook that I recently sold. While technically capable of running the software, it was just too slow for my likes. I actually downgraded to a 12 inch screen and rMB, which is a lot faster and because of the clearer resolution just as capable of viewing all of Xcode that I need to see.