It's weird that it's considered a niche, really. By the same token, Western(as in "Cowboys, Gunslingers, and deserts" Westerns)games should be MUCH more prevalent then they are and yet there's only a handful worth speaking of. There's the Red Dead games(mostly Redemption 1 and 2, since Revolver is barely known), Call of Juarez for the FPS variant and Desperados as a the Stealth take on it(and that's kind of a weird Niche intersection). There's probably others but I can't think of any off the top of my head.
I mean, Pirates and Gunslingers have a fair bit in common, since both tend to play off the " Roguish type wandering about the Frontier, having adventures and trying to make a living/fortune before the authorities clamp down and being a successful outlaw ceases to be viable" theme which always seems to maintain some form of popularity.
I think the issue with both those genres, is that it's difficult to capture the appeal of the settings, in a way that translates easily to game controls. For the pirate genre, it's about the seas, and sailing, and oceanic physics, and that stuff, based on how janky water physics has been for decades in games, apparently isn't easy. So trying to tailor a game entirely around that system, is likely difficult. Same with cowboy stuff. The appeal of that genre, at least based on the cliche tropes of it, is the showdown and quickdraw combat, and if RDR2 is any indication, given how bloated and clunky it's mechanics system is, it's just as hard to pull that off well too. I find the quickdraw sequences in RDR2 annoying as hell, and the combat in general is just bad.
Plus, I don't think those 2 genres are actually as widely popular as think? Pirates have been on the outs, media wise, with the dying off of the PotC franchise, and hadn't been very big prior to that either. There isn't a real "clamoring masses" screaming for games in the genre, for either of them.
I mean I don't consider myself a fan of pirates as a genre, and have never actively sought out their games. The only reason I praise AC: Black Flag so much, is I played AC: 3, where they introduced their sailing mechanics, and I found it fun as hell. And then Black Flag improved on it. And while I would love more games like Black Flag in concept, it's not a case of "OMG I must have more pirate stuff because I love pirates!!" It's more "that combat/sailing system was really fun an engaging, I would play that whether it was a pirate skinned system or something else"
And cowboy stuff....well, personally I've never seen the appeal really. I'm playing RDR2, but it's more for the ancillary aspects of the game. Every time Dutch's gang try and whine about "the loss of their freedom, to live FREE, in FREEDOMNESS!! Away from LAWS, and being told what to do by THE MAN!! Because we're MEN!! And men are FREE!" I just roll my eyes and say to the screen. "Yeah, but you are all fucking criminals, liars, thieves and murderers. The most morally upstanding of your bunch, that I've seen so far, are the women who are prostitutes, who I personally see as at least honorable work, compared to the rest of you. You're complaining that the rest of society is tired of you leeching off of their actions to survive. So I don't really fucking care what you think about the loss of your way of life. You're way of life is literally a criminal gang, so fuck off."