I think you’ll have trouble finding a 15-40 9s cassette. It’s possible that you could buy two 9s cassettes and mix/match the cogs to get the gears you want, but this might require a bit of digging to find two cassettes that (1) have individual, loose cogs, not one or more “clusters” that are permanently attached and (2) have the right combination of cogs to get the gears you want. I have done this with 8s when I build an 11-18 cassette for my trainer…pretty sure I found literally the only two Sunrace cassettes that would make it work…but it did!
Downside (which I’m about to run into now) is that each time you replace a cassette you are now buying two cassettes. What size chainring(s) and what crankset are you running? If you can downsize the chainrings, you might be able to get a similar range out of a more common 11-32 or 12-36 9s cassette. If you have a double or triple, you might not even need to do that if you are willing to spend more time in the next smaller ring.