Any Shimano compatable rear mech as long as it has enough travel for the cassette width!
My Daughter is using an old 7 speed Alivio on a 9 speed cassette no issues.
7/8/9/10 Road is comapatibe with 7/8/9 MTB (assuming the correct cassette including the road 10speed cassette).
10 speed MTB is an entirely new system, the mech only work with 10speed mtb shifters and vice versa. The cassette is also slightly wider so doesn't use the 10speed spacer from the road cassettes. So you can't run a road casette in a mtb (well you can, but the shifitng isn't quite perfect, it'll be 0.1mm out with each gear depending on wher you set it that 0.5 each end or 0 one end and 1.0 the other). The chans are also different, DA chains are no longer the same as XTR (XT/ultegra, SLX/105, etc).
SRAM and shimano chains and cassettes are also interchangeable on the road (to an extent).
MTB they tweaked the chain/cassette in different ways, so whilst they're the same spaceing (so you can run SRAM shifters/mech on a shimano chain and cassette) the side plates and links are different widths, one has rollers links and sprockets (9s thickness) but thinner side plates, the other has thinner sprockets but ,retains the same side plate thickness as 9s but in a narrower chain. So supposedly SRAM/SRAM and Shimani/Shimano works best for chains/cassettes, but plenty of people have found a mix to work, and the road chains work well enough too, ditto 3rd parties like KMC.