I have been using xiaomi phones for a long time now, for most of them the (xda) community eventually had great ROMs that (eventually) worked without problems or with very little.

Though these days I need a working phone so I didn’t bother with my (Mediatek) Note 8 Pro - last time I looked phones with these chips were a lot harder and more dangerous to flash then the Qualcomms I had before (loved my Xiaomi A1 for that tinkering with Ressurection Remix).

So I am looking for an investment - a device I won’t have to replace for another ~6+ years but I really want my device to do mostly what I would expect, without any snooping or other privacy shenannigans - I know xiaomi is probably the worse choice for this but their hardware specs were always the best for the price and were generally easy to flash.
I don’t like pixels - they are too expensive for the hardware it offers, at least in my country.

Thank you for any tips in advance.

Update: iPhone is a no go for me because of the walled garden - I am a software developer by trade and hobbyist, I like to have the possibility of cracking the device open, both HW and SW wise. I am willing to trade the longevity of the device for this.