Assume I pricing some commodity derivative that has a running cost with $\$c$ being paid per unit of time. So I define the price under the risk neutral measure to be $$P(t,S_t)=\tilde{\mathbb{E}}\left[e^{-r(T-t)}F(S_T)+\int_t^T c\,e^{-r(s-t)}\text{ds}\,|\,\mathcal{F}_t\right]$$ Now if I multiply both sides by $e^{-rt}$, I have "discounted price of a derivative" on the left, and from the fact that discounted price functions are martingales under risk neutral measure I could calculate $d(e^{-rt}P(t,S_t))$ and set the $dt$ term to zero.
But clearly, that would be a wrong pde in this case. I can see that if I break $\int_t^T=\int_0^T-\int_0^t$ and move the second part to the left, I will get a martingale and I should do Ito on that one. So does the argument "all discounted traded derivatives are martingales under risk neutral measure" doesn't apply in this case? And the argument valid only for the derivatives that have a payoff at maturity $T$? I have not see that mentioned anywhere in EEM pricing.