Why we choose the pressure of surronding is because that makes the calculation more easier.
The equation is actually a negative value of work that the surronding does to system. First of all, it should be clear that work is not state functionthe value of work depends on the what path to go. Consider a expansion process, the gas itself is not in equilibrium, which means there is no certain T, V or p which can describe a certain state of the system. Three values of them may probably change all the time. Therefore, strictly speaking, we can only discuss 'partial pressure' of a specific part in the system. If you choose the 'partial pressure' around the piston to calculate the work, that requires complicated hydrodynamics calculation.
Furthermore, if you get insight into the path of the expansion in more details, you will find the piston is vibrating affected by the gas, not 'smoothly' moving from oneside to another. The gas is like a oscillator, continuously doing positive and negative work for the system until equilibrium is obtained, in which the pressure of gas ceaselessly changes.
Wherefore, the main reason why we choose external pressure of the system is because the pressure of surronding can be treated as unchangeable value. Although the expansion work is still not the state function, we can easily attain the expansion work by using initial and final state of the system which is the volume change of gas.