It's actually worse than that. For "direct" (but not non-stop) flights that have the same flight number, it is treated as if the flight were non-stop.
So you will get one segment for the flight even though it stops along the way. You will also only get the miles from your original destination to your second destination.
For example, if you are flying SFO-PHX-DCA on one flight number, you will receive credit for one segment and the miles direct from SFO-DCA, not the sum of SFO-PHX + PHX-DCA. That can be a significant difference.