replacing cassette & chainset
Generally speaking, a frame/wheel hub that is fitted with a 8/9/10 speed cassette can take any of 8/9/10 speed because they're all the same width, just pack an extra cog or two in by thinning down the chain and inter-cog spacing.
11 may be possible but it depends on how the cassette can overhang inboard of the freehub without grinding.  12/13/14 speed is right out, unless you're buying a new bike.
The reason for staying with 9 is that you don't need to change the shifter and possibly rear derailleur.  The cost of these parts adds up, so going to 10 speed gives you only one more cog but costs a lot more.   Minimal change from maximal expense.

You're right the chain absolutely needs changing.  The chainrings may be adequate as-is, but its wear-dependent.  Also check your derailleur's jockey wheels - there its sideways slop more than tooth wear.

Mostly all 9 speed stuff is interchangeable. At 10 speed the standards start diverging, with differences in MTB/road, and tiagra doing its own weird mixed up standard.
Personally I'd replace with a 9 speed chain and cassette, check for wear in jockey wheels and chainset, and then keep riding.     Shout yourself some new bartape too, and the bike will feel awesome.