Derailleurs don't care about the number of speeds. (Within reason-to avoid major repercussions from that statement.) It just goes where it's told to by the shifter. Matching the shifter number of speeds to the cassette and road to road vs. a mix of mtn/rd components is more of a concern to eliminate having to utilize "alternative" methods to get things to play well together.