Hell yes. Of course, training through prolonged sore legs, or going harder and harder on worsening wore legs isn't smart, but if you're really pushing for your best improvement, it's going to happen on sore legs. A lot.
Try running sometime - you haven't seen working out on sore legs until you try it. Makes cycling look like baby stuff in terms of sore legs, which is why you see day after day of grueling TdF hillcimbs, whereas you'll never see a multiday fast marathon race tour. (Ultramarathons are a different, much slower event.)