A phased plasma pistol in the 40 watt range.
In all seriousness, I agree that with the brass case, gunpowder, jacketed lead bullet technology little is ever likely to supplant the 9mm in terms of popularity, so long as magazine capacity remains essentially unrestricted. .40S&W became a lot more popular during the AWB because of the 10 round mag limit. If you only get 10 max, might as well be the most powerful 10 rounds you can handle. But with 16+ round mags available again the extra capacity is more attractive. Especially since 9mm, .40 and .45ACP perform so similarly nowadays anyway.
As mentioned, maybe if a smaller diameter round could be boosted to perform as well terminally while giving even higher mag capacity the might do it. But more likely will be something that isn’t brass cased gunpowder propelled ammo. In other words, unlikely we’ll see anything that supplants 9mm for many, many, many years.