Hardware is expensive, but how much of that expense is the CPU and how much of it is the variety of screens and cases that you would still need to have to switch form factors?
If you have a monitor, keyboard, and mouse, it's (theoretically) possible to use a smartphone as a desktop PC. That's also the least popular form factor for a computing device these days. Laptops or tablets would, even on the physical level, be much harder to pull off this way.
For a laptop, all you need is a keyboard/screen clamshell unit with a docking port for the phone where a drive would be on a typical laptop.
A tablet is pretty similar, but the dock needs to be behind the screen, which probably makes a thicker than average tablet. Or you just make a foldable phone which folds out to a tablet.