I disagree, from first hand experience. I had a flagship note 1, as soon as note 2 came, no more android updates, security [patches, ZERO, and the next up version of android was so different, half the apps updated to a point where they had to make a choice to cut off the old version of android or some of the apps offered two versions of the app to support older versions of android.
My brother in-law had a S5, same story, S6 (or 7, I don't quite remember if that was the battery debacle or not) came, and his device no longer got ANYTHING from samsung.
Two builds OTA from the carrier....no way.
Security updates didn't really come to the forefront until the security patch level appeared in phone's about screens in 2015 or so.
But what I'm thinking is that if your experience isn't in line with the list below, your service provider probably interfered or decided updates wouldn't be pushed.
Back in 2013-ish, there was some hubbub about how AT&T delayed a major OS and firmware update for the Lumia 920 and 820 for over several months. Or how Verizon decided not to release Windows Phone 8.1 for their WP8.0 devices. (until they had a change of heart with 8.1 Update 1.)
They have a lot of control but hey, sometimes weird things happen like in the case of the T-Mo S4 as noted before.
Samsung is hardly the shining example of speed and consistency to hold up but still...
Galaxy S III - Launched in May 2012 with 4.0.4 Ice Cream Sandwich, currently on 4.3 Jelly Bean. (with some 2 GB RAM models on 4.4 KitKat.)
Galaxy S 4 - Launched in April 2013 with 4.2.2 Jelly Bean, upgraded to 5.0.1 Lollipop. (and weirdly enough, the T-Mobile one got January 2017's security update)
Galaxy S 5 - Launched in April 2014 with 4.4.2 KitKat, upgraded to 6.0 Marshmallow to date.
Galaxy S 6 - Launched in March 2015 with 5.0.2 Lollipop, upgraded to 7.0 Nougat to date.
Galaxy S 7 - Launched in March 2016 6.0 Marshmallow, upgraded to 7.0 Nougat and 8.x O_ is not even available yet.
Galaxy Note - Launched in October 2011(!) with 2.3.5 Gingerbread, upgraded to 4.1.2 Jelly Bean to date.
Galaxy Note II - Launched in September 2012 with 4.1.1 Jelly Bean, upgraded to 4.4.2 KitKat to date.
Galaxy Note III - Launched in September 2013 with 4.3 Jelly Bean, upgraded to 5.0 Lollipop to date.
Galaxy Note 4 - Launched in October 2014 with 4.4.4 KitKat, upgraded to 6.0 Marshmallow to date.
Galaxy Note 5 - Launched in August 2015 with 5.1 Lollipop, upgraded to 7.0 Nougat to date.