It appears that Sony has been planning a dedicated Remote Play handheld for a long time. In fact, there's evidence suggesting work began on what would become PS Portal at least eight years ago — long enough back that it could've potentially been made for PS4.
Fans have dug up a patent, filed by Sony in 2015 and published two years later, depicting a device visually very similar to the Portal. It was reported on by IGN at the time, where it was speculated that the mystery handheld might've been Sony's answer to the Nintendo Switch. However, it's almost certainly an early patent for the PS Portal.
It's interesting to look back on; the patent's diagram shows a version of the handheld rocking DualShock 4-like handles either side of the screen. It can be inferred that this was, at least at one point, being designed with PS4 in mind. No doubt the PS5 was already in the planning stages by this point, though, so it's possible Sony opted to make it an accessory for its new console instead.
Anyway, it's always good to get a feel for how long these things take to come to fruition. Of course, not all patents and products make it to market, but the PS Portal is here now, and it's selling out fast.