Suppose the firm has a minimum cost function $C(\vec{w}, q)$ and sets up the following profit maximisation problem:
$max_{q} \text{ } pq - C(\vec{w}, q)$. The below FOC characterises the solution:
$p = C_q(\vec{w}, q)$ where the subscript denotes partial derivatives.
If I understand correctly, rearranging the FOC to get the $q$ as a function of $\vec{w}$ and $p$ gives us the supply function $S(\vec{w}, p) = q$. To investigate $q$'s response to changes in $p$ and $\vec{w}$ we substitute the supply function into the FOC from which it was originally derived:
$$p = C_q(\vec{w}, S(\vec{w}, p))$$
Then we would compute partial derivatives and study its signs. What is the intution behind the maths that allow us to rearrange an equation only to substitute the result back into that same equation? If we have an equation $y = x + 3$ and rearrange it to $x = y - 3$, would not there be very little use in substituting the latter into the former to arrive at $y = y$?