The ideal sheaf of the base change of a closed immersion Let $i:Z\to X$ be a closed immersion of schemes of quasi-coherent ideal sheaf $\mathcal{I}$ and $f:Y\to X$ be a morphism of schemes.
$\require{AMScd}$
\begin{CD}
W @>{j}>> Y\\
@V g V V @VV f V\\
Z @>{i}>> X
\end{CD}
Let $W$ be the fiber product. Then $j:W\to Y$ is a closed immersion by [https://stacks.math.columbia.edu/tag/01QR]. What is the ideal sheaf $\mathcal{J}$ corresponding to $j$?
Some examples (maybe I am wrong):
1.If $f$ is affine, $Y=\underline{\mathrm{Spec}}(\mathcal{A})$, $\mathcal{A}$ being a quasi-coherent $O_X$-algebra. Then $\mathcal{I}\mathcal{A}$ is an $\mathcal{A}$-module and $\tilde{\mathcal{IA}}=\mathcal{J}$.
2.If $Y=\underline{\mathrm{Proj}}(\mathcal{R})$, $\mathcal{R}$ being a quasi-coherent graded $O_X$-algebra. Then $\tilde{\mathcal{IR}}=\mathcal{J}$.
3.If $f$ is flat, then by EGA3, Ch.III, Proposition 1.4.15, $j_*O_W=f^*i_*O_Z$. Recall the SES $$0\to\mathcal{I}\to O_X\to i_*O_Z\to0.$$
As $f$ is flat, we have a SES $$0\to f^*I\to O_Y\to j_*O_W\to0.$$ So, $\mathcal{J}=f^*I$
What about the  general case?
 A: If we follow the chain of lemmas cited in the proof of the lemma you linked, we arrive at Stacks Project, Lemma 26.4.7 (tag 01HQ), which tells us that, in general, $\mathcal{J} = \operatorname{Im}(f^* \mathcal{I} \to \mathcal{O}_Y)$.
The key point (which implies the universal property of the fiber product for the closed subscheme corresponding to $\mathcal{J}$) is that a morphism $\varphi\colon W \to X$ factors through the closed immersion $i\colon Z \to X$ if and only if the map $\varphi^* \mathcal{I} \to \varphi^* \mathcal{O}_X = \mathcal{O}_W$ is zero. The forward implication is trivial. For the reverse implication, the topological part of this statement can be checked on stalks. The statement on sheaves follows from the adjunction between $f^*$ and $f_*$, which gives a correspondence between maps $\varphi^* \mathcal{I} \to \mathcal{O}_W$ and maps $\mathcal{I} \to \varphi_* \mathcal{O}_W$, so since these maps are zero, we get a map $\mathcal{O}_X/\mathcal{I} \to \varphi_* \mathcal{O}_W$ and thus a factorization $W \to Z \to X$. Details can be found in Stacks Project, Lemma 26.4.6 (tag 01HP).
