Well you claim that you have an
The isomorphism $f^* q^* \cong p^*$ . When you write out its definition, coming from induced by $q_* f_* \cong p_*$ is defined to be the canonical isomorphism composition
$p_* f^* q^* \to f^* q^* p_* p^* \cong f^* q^* q_* f_*$, you will see that by definition f_* p^* \to f^* f_* p^* \to p^*$.
Now it is easily checked that your the two morphisms are identicaldefinitions of the morphism agree. In fact, the first one is more natural, whereas the second one is somehow artificial since it coindices with the first one plus an expansion of the isomorphism $f^* q^* \cong p^*$, which is then removed again.
More generally, if $p: X \to S,~ p' : X' \to S,~ q' : X' \to X, ~q : S' \to S$ are morphisms (in your case $p=id$) such that the obvious diagram commutes, then there is a natural transformation $p'^* q_* \to q_* p'^*$. It is studied, for example, in EGA I, 9.3. Remark that we only use here that we have a weakly commutative diagramm of categories and functors such that the vertical functors $p_*,p'_*$ have left adjoints. See this paper by Calmes, Hornbostel (Lemma 1.2.6) for a generalization to categories.