Black Scholes derivation: Why treat Delta as a constant?

In the derivation of the Black-Scholes equation, it is argued (e.g. in the original paper and in Hull) that $$dV(S_t, t)=(…)dt + \frac{\partial V}{\partial S} dS_t,$$ where $$V(S_t, t)$$ is the value at time $$t$$ of an option on an asset with price process $$S$$. Thus, adding an amount of $$-\frac{\partial V}{\partial S}$$ assets to the option would make the resulting portfolio $$P$$ riskless since $$dP(S_t, t) \\ =(…)dt + \frac{\partial V}{\partial S} dS_t - d(\frac{\partial V}{\partial S} S_t) \\ =(…)dt + \frac{\partial V}{\partial S} dS_t - \frac{\partial V}{\partial S} dS_t \\ = (…)dt.$$

Why is the second equation true? We are treating $$\frac{\partial V}{\partial S}$$ like a constant when pulling it out of the derivative while it is actually a function of $$t$$ and $$S$$. Wouldn’t we have to use the Ito Product Rule here? (and I wouldn’t know how to do that since I don’t know the dynamics of $$\frac{\partial V}{\partial S}$$)