Rear derailleur speed number interchangability
You're right, indexing is handled by the shifters.  So if you replace the 8 speed to cassette with a 9-speed cassette you should be able to use the same derailleur.  But you will have to upgrade your shifters.  The only caveat with the derailleur is that it has to be long enough to accommodate the amount of chain slack generated by going from the largest gear to the smallest gear. This becomes a problem when trying to use a road derailleur with a mountain bike, which usually has a much bigger range of gears.