I think we are making things too complicated here. If you are only asking about form factor, then the underlying technology utilizing said form factor becomes less of an issue.
The only thing keeping the 3.5" form factor alive is spinning rust. The migration away from HDDs may have plateaued somewhat, but I am not seeing much reason for people to continue messing with spinning rust, even from a cost perspective. Maybe the cloud providers will continue to use it? But if you look at mass-market desktop/AiOs and laptops, the move away from rust continues. Even el-cheapo $400 desktop systems are getting 120/128GB SSD options in them. When I helped a family member buy an AiO desktop back in 2014, she wound up with a cheap AMD cat core system with a 5200 rpm laptop hard drive. Same family member replaced it in 2018 with a cheap Goldmont+ AiO with a 7200rpm hard drive. Anything more expensive had an SSD in it.
There are still bargain-basement systems out there shipping with 7200 rpm harddrives. Those will probably vanish in 1-2 years, which will mean a big hit to spinning rust. Granted some of those drives are 2.5", if not all of them. But when you continue to reduce the amount of spinning rust on the market, you hit the companies that sell the spinning rust - the only guys still at all invested in the 3.5" form factor. So, in the long run, even if 2.5" rust drives leave the market, it actually helps usher out the 3.5" form factor.
I don't see 2.5" going anywhere since you can pack different technology into that form factor. I see the major limitation here being the interface. There's no particular reason why it has to be that way.
M.2 is going places since it hosts the fastest and most-sophisticated single-device storage solutions out there and because it can also fit into tiny spaces. The interface, as I've used it, is kind of goony though. On my desktop system, where PCB space comes at a premium, does it make sense to lay a gumstick flat between some PCIe slots and then screw it in? No, not really. The SATA interface was clearly designed with desktops like mine in mind, while M.2 put other concerns to the forefront. When it comes to people creating huge storage cluster devices, I kind of wonder if M.2 makes any sense, either, unless they use funky riser cards or something else to make it work. 2.5" interface says, "Look, put whatever you want inside the device, and then use this cable here to a tiny plug on the PCB". It definitely does a better job of saving space on the PCB when you have open space elsewhere to place the drive. That was never the goal behind M.2. And really, NVDIMM-P will suffer the same issue.