My question is about this Example in the stacks project. Let $(X,\mathcal{O}_X)$ be a locally ringed space with a sheaf of $\mathcal{O}_X$-ideal $\mathcal{I}$. Then the support of the $\mathcal{O}_X$-module sheaf $\mathcal{O}_X/\mathcal{I}$ defines a closed subset $Y$ of $X$. Note that the support is closed because the sheaf is finitely generated. We may endow $Y$ with a sheaf $\mathcal{O}_X/\mathcal{I}|_Y$ (or $i^{-1}(\mathcal{O}_X/\mathcal{I})$ for the inclusion morphism of topological spaces $Y\to X$). Then $(Y,\mathcal{O}_X/\mathcal{I}|_Y)$ is a locally ringed space with a natural morphism of locally ringed spaces $(Y,\mathcal{O}_X/\mathcal{I}|_Y)\to (X,\mathcal{O}_X)$.
Where exactly do we need the assumption that $\mathcal{I}$ is locally generated by sections as an $\mathcal{O}_X$-module sheaf.
I am sure we DO need that assumption. If not then whenever $X$ is a scheme $Y$ would be a scheme too but this is clearly wrong (for example Taking ideal sheaf which is not locally generated by sections, where does it fail to construct a closed subscheme).
There is no need for $\mathcal{I}$ to be locally generated by sections for any of the statements you've written. This assumption is only needed for the additional assertion that the inclusion map $Y\to X$ is a closed immersion of locally ringed spaces (since that condition is part of the definition of a closed immersion).