It did happen. Samsung DeX is a desktop environment that you get when you plug your tablet or phone into a screen. It's passable but of course most Android apps aren't designed for work.
They also did a Linux on DeX. You could boot Ubuntu on your Samsung phone and display it via HDMI. They stopped supporting it around Android 10 though, presumably nobody ever used it.
Huawei P20 and P30 series, Mate 20 and 30 series do this. Plug a USB-C cable to an external monitor, Bluetooth mouse and keyboard and you have a desktop like experience, with apps opening in Windows like you'd expect on a desktop. This includes a taskbar, pinned apps, resizable windows and more. No extra hardware needed.
I realize now it’ll probably never happen, since the companies making the phones are the same companies that make computers.