Whilst V2 will enable at least the minimum climb gradient for obstacle clearance it won't necessarily be the greatest gradient. However, barring some unusual circumstance, the a/c is 'guaranteed' to achieve xyz gradient & the departure path vs obstacles is planned accordingly.
A deliberately increased V2 take off may be appropriate to clear some types of limiting obstacles ie increasing the time accelerating on the ground in order to achieve a faster V2 once airborne. Jets are usually on the back of the power curve during their initial climb so increasing V2 reduces drag with a resulting increase in climb performance. The catch is the longer runway needed to accelerate, V1 limits, brake limits etc etc.