I like to keep my cars a long time, so, based on my own research, this is what I've found:
American cars - basically crap outside the warranty period.
German cars - crazy expensive to maintain outside the warranty period.
For Japanese cars, I would rank Toyota/Lexus first, followed by Honda/Acura. I wouldn't touch Nissan - their quality has plummeted, especially in cars with the CVT.
Hyundai/Kia seem pretty good. From what I've seen, they seem to be holding up well over time.
I ended up buying a 2011 Lexus with 52k miles in late 2017. I only drive around 7500 miles per year, so I hope to keep this car for a long time. I paid 33% of original MSRP.
As for EVs, the battery technology isn't there for me yet. The new glass battery (solid state) may be the answer, but it'll be a few years before it's commercially viable, if in fact everything I've heard about it is true. So who knows, maybe in ten years I'll be able to buy an EV with a 500-mile range that can be recharged in five minutes. If that happens, then gas-powered cars will be on the way out in a hurry.