I suggest this is related (vaguely) to the Sugiah of Yevamos 21a "אתי עשה ודחי ללא תעשה" - the positive Mitzvahs override the negative ones vs. the verse "סור מרע ועשה טוב".
The Gemmorah presents the approach that the benefits of positive Mitzvahs are more valuable that the possible (spiritual) loss from transgressing negative ones. For example, that approach (basically a traditional Chassidic approach following BaaSh"T heritage) is clearly adopted by Chabad (*it is ), living among gentiles in far and weird places, "sabotaging" their religious lives and lives of their wives and kids.
So for them Pursuing Shalom is definitely more valuable.
On the other hand, the standard "Litvakes" or non-Chassidic approach is derived from that verse "סור מרע ועשה טוב", interpreting the precedence of סור מרע to עשה טוב as preference of not losing to earning a Mitzvah, in your case "keeping distance from a bad person".