Let $e$ be the vector whose components are all ones.
Then
$$\eqalign{
b &= Ae \cr
D &= \operatorname{Diag}(b) \cr
P &= D^{-1} \cr
dP &= -P\,dD\,P \cr
}$$
Those matrices are all diagonal, so apply the diag() operator (which is the reverse of the Diag() operator) to obtain
$$\eqalign{
dp &= -P^2\,db \cr
&= -P^2\,dA\,e \cr
}$$
Now vectorize both sides
$$\eqalign{
dp &= -\operatorname{vec}(P^2\,dA\,e) \cr
&= -(e^T\otimes P^2)\,\operatorname{vec}(dA) \cr
&= -(e^T\otimes P^2)\,da \cr\cr
\frac{\partial p}{\partial a} &= -\,e^T\otimes P^2 \cr\cr
}$$
If you don't wish to vectorize, then you must use higher-order tensors to express the result.
Let $T$ be a 3rd-order tensor, and $F$ a 4th-order tensor, with components given by
$$\eqalign{T_{ijk} &= \begin{cases} 1 &\text{if }(i=j=k) \\ 0 & \text{otherwise}\end{cases}\cr
F_{ijkm} &= \delta_{ik}\,\delta_{jm} \cr
}$$
Then picking up the previous thread just before vectorization
$$\eqalign{
dp &= -P^2\,dA\,e \cr
\cr
dP &= T\,dp \cr &= -T\,P^2\,dA\,e \cr
&= -T\,P^2\,F\,e^T:dA \cr
\cr
\frac{\partial P}{\partial A} &= -T\,P^2\,F\,e^T \cr
}$$