The last time true mix and match was possible on Shimano cassettes was with Uniglide, which must be 20 years ago by now.
All you needed was the right number of sprockets and the appropriate thickness of spacer (for 6/7/8 speed). You could even turn the sprockets round when one side was worn.
Hyperglide sprockets (as current) have ramps and gates and things that must be aligned with the adjacent sprockets for good shifting. You'll see code letters after the spocket size (eg 15au), and there are tables that show what works next to what. You are at the mercy of what Shimano choose to make, which is what they use on their own cassettes, so you may find what's needed, or you may not.
You can of course ignore matching the sprockets, but shifting will suffer.
Loose sprockets are available from Rose - go to "cassettes" and sort by cheapest first to see what's available.
I think that's 9, 10 and 11-speed up to 18 or 19T, after which it's groups of 2 or 3 sprockets on carriers.