Graph measurability of $P$ is not sufficient. Let $E\subseteq[0,1]^2$ be a Borel set whose projection $\pi(E)$ onto the first coordinate is not Borel. Let $X=\mathbb{R}$ and let $B$ have the constant value $[0,1]$. Let $P$ have graph $T\times E$. Then $D$ has graph $T\times\pi(E)$$T\times [0,1]\setminus\pi(E)$ and is, therefore, not graph measurable.