This isn't true of flagship android phones which are more comparable to the iPhone. For example, my Galaxy S9 continues to work excellently besides the aging battery.
Samsung phones are exactly like what the GP describes. Maybe things have changed now but Samsung phones used to get only 2 Android version updates
they largely still only get two major version updates. I've stopped buying Samsung phones and started using a $300 Pixel. A third of the cost compared to a $1000 samsung phone. I can junk it after 2 years and just get another one.
Funny you say that, because I just had to replace my Galaxy S9 at slightly under two years of age. It became unusable due to a defect called the "Samsung green screen of death", which I learned is widespread, age-related, and unfixable.
Allow me to introduce Pixel 6 and the Android 12 fiasco...