You've been told wrong.
Bear in mind, a derailleur is pretty dumb. It doesn't know what kind of bike it's mounted or what sort of lever is pulling its cable. It also doesn't know how many cogs are on your cassette. It doesn't have to in order to do its job.
The cable moves, and the RD moves accordingly. The lever is what decides how much cable to pull or release, and by extension, how much the derailleur moves.
In other words, it's not the derailleur that's indexed, it's the levers.
(For completeness, this refers to traditional mechanical systems. Electronic ones, like Shimano Di2 and Campagnolo EPS, have reversed where the intelligence lives. The levers or buttons are dumb, the derailleur knows how far to move based upon its current position and which button is pressed.)