This answer is community wiki.
Preparation
Before it always holds:
$$\mathcal{D}\supseteq\mathcal{D}\cap\mathcal{S}+\mathcal{D}\cap\mathcal{S}^\perp$$
Especially one has:
$$P\mathcal{D}\subseteq\mathcal{D}\iff\mathcal{D}=\mathcal{D}\cap\mathcal{S}+\mathcal{D}\cap\mathcal{S}^\perp$$
(That will be crucial below!)
Characterization
On the one hand one has:
$$PT\subseteq TP\implies P\mathcal{D}\subseteq\mathcal{D}$$
Concluding that they're invariant as:
$$\varphi\in\mathcal{D}\cap\mathcal{S}:\quad T\varphi=TP\varphi=PT\varphi\in\mathcal{S}$$
$$\psi\in\mathcal{D}\cap\mathcal{S}^\perp:\quad T\psi=T(1-P)\psi=(1-P)T\psi\in\mathcal{S}^\perp$$
On the other hand one has:
$$P\mathcal{D}\subseteq\mathcal{D}\implies\mathcal{D}(PT)\subseteq\mathcal{D}(TP)$$
Concluding that they commute as:
$$\varphi\in\mathcal{D}:\quad PT\varphi=PT\varphi_\parallel+ PT\varphi_\perp=T\varphi_\parallel=TP\varphi$$
(Here equality above was crucial!)
Strictness
Consider an operator:
$$T:\mathcal{D}(T)\to\mathcal{H}:\quad\mathcal{D}(T)\subsetneq\mathcal{H}$$
Regard any closed subspace:
$$P^2=P=P^*:\quad\mathcal{R}(P)\subseteq\mathcal{D}(T)$$
Then extension will be strict:
$$\mathcal{D}(PT)=\mathcal{D}(T)\subsetneq\mathcal{H}=\mathcal{D}(TP)$$
(Note that happens in most cases!)