While I use an iPhone and would recommend it , you could easily get a phone like the pixel , one plus , etc that support lineageos or other 3rd party roms and that will keep support years after the vendor does. I will probably go that route next time because it’s not like the phone is unusable or slow after no more updates.
I have been on pixel my last few phones (currently on 6a). While I've done 3p roms on my phones before, I'm not as interested in tinkering with them anymore.