I used to think stretching was stupid. Then I got old. Now I find that stretching reduces soreness the next day after a run. Certainly others have had the same experience?
The only way avoid getting sore is to increase your load progressively, or stay at a load you're accustomed to.
Being flexible might help with soreness in a sense that the soreness is less noticable: for example if you have very tight hamstrings, and they are sore, any movement is likely to make that soreness noticable. If, however, you are quite flexibly you might have to stretch your hamstrings, by bending at the waist, before you actually notice that you are indeed a bit sore after yesterday's workout.