I think the answer here is probably no, but basically I’m planning to get a trainer for when it’s cold/dark (probably the Zwift one since it seems cheap for what it gives you). This comes with its own cassette, and you can choose the number of speeds/rings. My bike (an entry-level disc brake Trek Domane) which i would be mounting on the trainer is a 9-speed Claris groupset, but if possible I’d like to have a larger 11-speed cassette on my trainer so I can sort of future proof it for future bike upgrades. My impression is that this definitely wouldn’t work if I was just adding a higher speed cassette to my actual bike, but was wondering if there’s any way it’s doable with a trainer?
No, you cannot. Not even when only using just certain 8 sprockets (yes, Claris is 8 speed, not 9). The dimensions are all different and the shifter and the rear derailleur will not be able to use it. You cannot also just install also an 11-speed rear derailleur. You would also need a compatible shifter and chain.
Also, your rear hub might not be able to take it because it may be just a 10-speed hub.
Overall, such bike cannot be upgraded by parts. One would have to change the whole drive train in one go and that is often financially nonsensical and it makes more sense to sell the old bike and buy a new one. I did such an upgrade (from Claris to GRX 400) but after a careful calculation and knowing that if I managed to sell it well, I could get a new one for the same money.
If you don’t need shifting to work on the trainer you might be able to get away with it. Assuming the chain/derailleur lines up with one of the sprockets and the chain is not so wide that it interferes with neighboring sprockets.
Apart from this uncertainty I see two reasons why I wouldn’t try it: 8 speed cassettes are dirt cheap and cassette wear (especially if you are only using a single sprocket) is not to be underestimated.
So I don’t think it makes sense to get an 11 speed cassette now (“just in case”) only to have to replace it due to wear in 3 years when you might actually be getting an 11 speed bike.