The real secret is to buy one of the devices the real core Lineage developers maintain because they will keep those security patches and major release updates coming to you for free that these billion dollar corporations couldn't be bothered to do.
If the entire Android ecosystem wasn't a disgusting exploitation machine meant to produce more rare earth metal waste than naval warfare by forcibly obsoleting devices every 2 years everyone would be better off. Every company could be sponsoring free software devs to support their phones in something like Lineage in perpetuity while paying a fraction what they do for their large internal dev teams to do it. But the perverse incentives mean they don't want to update phones, which also means making it hard to support their device in a real operating system like Lineage is in their interest.