Keep in mind, that in position space (where $\hat p$ is proportional to $\partial_x$, you always have to think of the commutator as acting on a wave function.
It is
$$ \langle x| \hat p A(\hat x) |\psi\rangle = \int dx^\prime \langle x|\hat p|x^\prime\rangle \langle x^\prime|A(\hat x) |\psi\rangle \\
= \int dx^\prime \delta(x-x^\prime) \frac{\partial}{\partial x^\prime} \left(A(x^\prime) \psi(x^\prime))\right)\\
= (\partial_x A(x))\psi(x) + A(x) (\partial_x \psi(x)).$$
So indeed the terms with a $\partial$ at the end will cancel, after you have applied the Leibniz rule.
EDIT: To see this, let your commutation relation operate on a wave function $\psi(x)$. Then $$[\pi_i, \pi_j] \psi(\vec x)= ie (\partial_i (A_j \psi(\vec x)) - A_j \partial_i \psi(\vec x) + A_i \partial_j \psi(\vec x) - \partial_j (A_i \psi(\vec x))),$$
where the contributions in which the derivative acts on $\psi$ cancel and you are left with
$$[\pi_i, \pi_j] = ie ((\partial_i A_j) - (\partial_j A_i)).$$
Now the derivatives only act on the potentials $A_i$ and not on a possible wave function that is multiplied from the right.