$\DeclareMathOperator{\Spec}{Spec}$$\newcommand{\pf}{\mathfrak{p}}$Let $A$ be a ring (commutative, with $1$), then its spectrum $\Spec A$ is the set of prime ideals of $A$. It can be turned into a topological space with the Zariski topology, whose closed sets are $$ V(I) = \{ \pf \in \Spec A : I \subseteq \pf \}, $$ for any ideal $I$ of $A$. (It also has more structure as a locally ringed space, but that won't be needed for the question.) This $V$ is an inclusion reversing map from the ideals of $A$ to the subsets of $\Spec A$. Both of these are lattices, so for each ring $A$ we get a map between these two lattices. This led me to try and think of $V$ in categorical terms as a natural transformation.
More precisely, we can consider two contravariant functors $F,G: \bf{CRing} \to \bf{Latt}$, such that $FA = \operatorname{Idl} A$ is the lattice of ideals of $A$ and $GA = \mathcal{P}(\Spec A)^{\rm{op}}$ is the lattice of subsets of $\Spec A$ with reversed inclusions. If $\varphi: A \to B$ is a morphism of rings, then $F\varphi: \operatorname{Idl} B \to \operatorname{Idl} A$ maps $J \mapsto \varphi^{-1}[J]$, and $G\varphi: \mathcal{P}(\Spec B)^{\rm{op}} \to \mathcal{P}(\Spec A)^{\rm{op}}$ maps $Y \mapsto \varphi^*[Y]$, where $\varphi^*: \Spec B \to \Spec A$ denotes the pullback induced by $\varphi$ on the spectra.
Then $V: F \to G$ should be able to be regarded as a natural transformation between these functors. However, this turns out to fail. For example, consider the inclusion $\varphi: \mathbb{Z} \hookrightarrow \mathbb{C}[x]$. Then, if we take the ideal $J = (x)$ of $\mathbb{C}[x]$, we have $V(\varphi^{-1}[J]) = V(0) = \Spec \mathbb{Z}$, but $\varphi^*[V(J)] = \varphi^*[\{(x)\}] = \{(0)\}$. This example also shows that this still doesn't work even if we restrict to just radical or even prime ideals.
However, this seems strange to me, since I believe this construction is natural in some way and that that should be translatable into categorical language.
As a bonus argument for my belief, we also have a construction in the opposite direction, but which can indeed be seen as a natural transformation. Given a subset $X \subseteq \Spec A$, we can also associate to it an ideal of $A$, given by $$I(X) = \bigcap_{\pf \in X} \pf.$$ Then $I: G \to F$ is a natural transformation: for any subset $Y \subseteq \Spec B$, it holds that $I(\varphi^*[Y]) = \varphi^{-1}[I(Y)]$ (this reduces to the statement that preimages commute with intersections).
This asymmetry is surprising to me, so I believe that in some way I am not formulating the $V$ construction correctly in categorical terms. Furthermore, having $V$ and $I$ as natural transformations would allow one to also talk about their compositions in this language (which send an ideal to its radical and a set to its closure, respectively).
Is there some way to reformulate or reinterpret this such that the interpretation of $V$ as a natural transformation is salvaged? Or is this ultimately just a dead end? Is there any deeper reason for the fact that $I$ is natural but $V$ is not?
In general we can identify $V(I)$ with $\text{Spec } A/I$, so if $\varphi : A \to B$ is a morphism of commutative rings and $I$ is an ideal of $B$, then $V(\phi^{-1}(I)) \cong \text{Spec } A/\phi^{-1}(I)$ while $\phi^{\ast}(V(I)) \cong \phi^{\ast}(\text{Spec } B/I)$. If $P \in \text{Spec } B/I$ is a prime ideal, then $\phi^{\ast}(P)$ is its preimage in $A$, which is a prime ideal containing $\phi^{-1}(I)$ and hence which is in $\text{Spec } A/\phi^{-1}(I)$. So we get a natural map
$$\phi^{\ast}(V(I)) \cong \phi^{\ast}(\text{Spec } B/I) \to \text{Spec } A/\phi^{-1}(I) \cong V(\phi^{-1}(I)).$$
This means that $V$ is lax natural (or maybe oplax, I don't want to check which direction the order is pointing). However, in general this map is not an isomorphism, as your example of $A = \mathbb{Z}, B = \mathbb{C}[x], I = (x)$ shows. By replacing $B$ with $B/I$ we can assume WLOG that $I = (0)$ here so what we are saying is that the map $\phi^{\ast}(\text{Spec } B) \to \text{Spec } A/\text{ker}(\phi)$ is not an isomorphism in general.
This lax naturality behavior actually isn't too unusual. Here's a maybe simpler example: consider the functor $F : \text{Top} \to \text{Lat}$ which assigns to a topological space its lattice of subspaces. Now consider the map $\overline{(-)} : F \to F$ which sends a subspace $S$ to its closure $\overline{S}$. If $f : X \to Y$ is a continuous map and $S \subseteq X$ is a subspace of $X$, then by continuity we get a natural inclusion $f(\overline{S}) \subseteq \overline{f(S)}$, but this natural inclusion is also not guaranteed to be an isomorphism in general, so taking closures is also lax natural. Since $V$ behaves like a closure operator (with respect to the Zariski topology) it exhibits similar behavior.