@Teiwaz - 'why sell 1 when they can sell you 2'
I think for Apple the equation would be rather different, since Macs are only about 5% of PC sales worldwide, but sells at least 10 iPhones for every Mac.
If they made it so you could install a 'macOS GUI/API' app on your iPhone, and sold a Lighting to HDMI & USB dongle so you could connect a monitor, keyboard and mouse, you'd basically have a Mac. Think of how useful something like this would be for "casual" PC users, who basically use them for browsing, email, light gaming, viewing/editing Office type documents once in a while (think college students writing papers) and hardly running any commercial applications beyond a tax or home accounting type software. You probably need a beefier CPU if you want to do 4K video editing, but many people's needs would be taken care of by this.
Sure, they'd lose a lot of Mac sales those who currently own an iPhone and a Mac, because they might decide they don't need to replace that Mac now that the iPhone can perform the role. But I think they'd gain a lot more in iPhone sales because of this capability than they'd lose Mac sales, and end up with more Mac users overall.
The one thing that makes this difficult is that the Mac uses an x86 CPU, and iPhone uses ARM. But that's not a real obstacle, they have supported fat binaries before and the millions of iPhone users who would adopt this would be a tempting market for every Mac software company. They could continue selling x86 Macs, and the iPhone would just be a "different" Mac. Sales of x86 Macs would drop, but they would not disappear as some will need a real laptop, high end performance or need x86 for running Windows.
Dunno how much RAM they'd need for this, probably 4GB at a minimum with 8GB desirable, but some phones already ship with that much so it could certainly be done if they decided they wanted to go this route.