It makes sense in the context of how delayed dead balls and immediate dead balls work. Because a hit-by-pitch results in an immediate dead ball, it negates the delayed dead ball caused by the illegal pitch. Therefore, only the batter and forced runners may advance in this situation.