Pretty unusual set of circumstances. D&D always dominates, it is just that at that time, Paizo was making the more popular version of it. Pretty sure 2e, 3e, and 3.5e were all developed while D&D was the top seller. Even if sales had come down substantially in each case.
You never know...except that some newish edition is coming in 2024.
3rd Edition was developed after WotC acquired the brand from TSR in 1999 (and was released in 2000). The brand was in tatters, and they had to do something to get people excited about D&D again...so they released a new edition of the game. The link that Morrus posted doesn't have data before 2004, so I don't know what the market looked like at that time. But what we do know is that D&D was the #1 selling TTRPG at least as early as 2004, and it remained so until Pathfinder was released in 2009.
But Pathfinder wouldn't have even been published if WotC hadn't released the 4th Edition of D&D.
Pathfinder was a strange product...I don't think there had ever been anything like it. It wasn't a new game system like FATE or Shadowrun, it was a D&D campaign setting that still used the D20 Game System and the D20 Open Gaming License. And it was released in response to pushback from players who didn't care for the new 4th Edition game, and from third-party publishers who wanted to continue publishing material under the OGL. It was a viable option for players and publishers who didn't want to switch to the new edition.
WotC took a pretty big gamble on 4E, betting that most players and third-party publishers would want to abandon the older system and switch to the new. They lost that bet.
D&D fell in the rankings continually afterward, quarter after quarter. They had to do something to get people excited about D&D again, so they released a new edition of the game. Three months later, 5E D&D jumped from No. 4 to No. 1, and has remained there ever since.
So I think that until their sales begin to slip again, Wizards of the Coast will remember the lesson they learned in 2008 and not tamper with a good thing. At least I hope they do.
But then again, Wizards of the Coast is more than just D&D. They are also Magic: the Gathering, and collectable card games are selling far better than all other tabletop RPG games combined at the moment. They could decide to do whatever they want with D&D completely on a lark, and they would financially survive it. (shrug) Time will tell, I guess.
But I've gotta ask: why 2024? Do you know something I don't? Did I miss a press release or something?