Question: "I mean, it would be a generalization if one could capture every prime ideal of $k[x_1,…,x_n]$ just by considering the homomorphisms with values in $k$, but still we need to consider homomorphisms in any field in order to capture every prime ideal of a generic ring; however as I said this is not the case."
In general the ring $A$ is not a $k$-algebra for $k$ a field.
Lemma: If $A$ is a commutative unital ring and $\mathfrak{p}\subseteq A$ is a prime ideal,
there is a field $K$ and a map of unital rings $\phi: A \rightarrow K$ with $\mathfrak{p}=ker(\phi)$.
Proof. Let $u:A\rightarrow A_{\mathfrak{p}}$ be the canonical map into the localization of
$A$. It follows prime ideals $\mathfrak{q}* \subseteq A_{\mathfrak{p}}$ corresponds 1-1 to a prime ideal $\mathfrak{q}\subseteq \mathfrak{p}$ in $A$. Hence the zero ideal $(o) \subseteq \kappa(\mathfrak{p})$ in the residue field $\kappa(\mathfrak{p})$ has inverse image $\mathfrak{p}$ under the canonical map $\phi_{\mathfrak{p}}: A \rightarrow \kappa(\mathfrak{p})$. Hence you may choose $\phi:=\phi_{\mathfrak{p}}$.
Hence any prime ideal in $A$ is the kernel of some map into a field $K$. The problem is that the "set of all fields $K$" is a "very large set" - it is not even a set! The set of prime ideals in $A$ is "smaller" and this is one reason to work with $Spec(A)$: Since $A$ is a set it follows $Spec(A)$ is a set - it is a subset of the set of all subsets of $A$.
Example. If $A$ is a $k$-algebra of finite type over a field $k$, a non-maximal prime ideal $\mathfrak{p}$ will in general have a residue field $\kappa(\mathfrak{p})$ that is no longer a finite extension of $k$. If $\mathfrak{p}$ is maximal it follows $k \subseteq \kappa(\mathfrak{p})$ is a finite extension.
Here you find a discussion on the problem of defining algebraic "varieties" avoiding prime ideals and instead using maps to fields or the space of maximal ideals:
https://mathoverflow.net/questions/377922/building-algebraic-geometry-without-prime-ideals/378961#378961
Note that if $A,B$ are commutative unital rings that are finitely generated over a field $k$ (or the integers $\mathbb{Z}$) the following holds:
Lemma.Let$\phi:A \rightarrow B$ be a map of rings and let $\mathfrak{m}\subseteq B$ be a maximal ideal. it follows $\phi^{-1}(\mathfrak{m})\subseteq A$ is a maximal ideal.
Proof. Assume $k$ is a field and let $\mathfrak{n}:=\phi^{-1}(\mathfrak{m})$. We get an inclusion of rings
$$ k \subseteq \kappa(\mathfrak{n}) \subseteq \kappa(\mathfrak{m})$$
and $\kappa(\mathfrak{n})$ is an integral domain. Since $\kappa(\mathfrak{m})$ is a finite extension of $k$ the following holds: Let $0\neq x\in \kappa(\mathfrak{n})$ be an element. There is a canonical surjective map
$$ \psi: k[t]\rightarrow k(x)$$
defined by $\psi(t):=x$, with $ker(\psi):=(p(t))$ for a non-zero ideal $p(t)\in k[t]$. Since $k(x)$ is an integral domain it follows $(p(t))$ is a maximal ideal, hence $x$ is a unit in $\kappa(\mathfrak{n})$, and it follows $\mathfrak{n}$ is a maximal ideal. A similar proof holds when $k$ is the ring of integers. QED.
If we let $Specm(A)$ denote the set of maximal ideals in $A$ we get by the Lemma an induced map
$$ \phi_m: Specm(B) \rightarrow Specm(A)$$
defined by $\phi_m(\mathfrak{m}):=\phi^{-1}(\mathfrak{m})$, and the map $\phi_m$ is continuous in the topology induced by the Zariski topology. Hence the classical map defined for the affine spectra
$$\phi: Spec(B) \rightarrow Spec(A)$$
induce a map at the level of maximal ideals.
There is a class of rings - Hilbert-Jacobson rings - where the following result holds:
Theorem. Let $A$ be a Hilbert-Jacobson ring and let $\phi: A\rightarrow B$ be a map of commutative unital rings where $B$ is a finitely generated $A$-algebra. It follows $B$ is a Hilbert-Jacobson ring, and for any maximal ideal $I\subseteq B$ it follows $J:=\phi^{-1}(I)\subseteq A$ is a maximal ideal and the canonical map $A/J \rightarrow B/I$ is a finite extension of fields.
A ring $A$ is a Hilbert-Jacobson ring iff every prime ideal in $A$ is the intersection of the maximal ideals containing it.
For this class of rings you get a well defined continuous map at the level of max-spectra and you can from such a ring $A$ construct a locally ringed space where the underlying topological space $X^m$ is the set of maximal ideals in $A$ with the Zariski topology, and where the structure sheaf $\mathcal{O}_{X^m}$ has nilpotent elements. Hence the ringed space $(X^m, \mathcal{O}_{X^m})$ is in a sense a "compromise" between a "classical algebraic variety" and a "scheme". If the base-ring is finitely generated over a field $k$ it follows the points in the topological space corresponds to solutions of systems of polynomial equations with values in a finite extension of $k$, hence the definition is in a sense "more intuitive" and "pedagogical" and it may be interesting for people teaching algebraic geometry.
If $A$ is a finitely generated algebra over a field $k$ let $X:=Spec(A)$. Let $X^m$ be the subset of $X$ consisting of maximal ideals (equipped with the induced topology) and let $i:X^m \rightarrow X$ be the canonical inclusion map. Let $\mathcal{O}_{X^m}:=i^{-1}(\mathcal{O}_X)$ be the topological inverse image. It follows the pair $(X^m , \mathcal{O}_{X^m})$ is a locally ringed space with $\Gamma(X^m, \mathcal{O}_{X^m}) \cong A$. This gives a well defined functorial way to construct a locally ringed space from $A$ where the topolopical space does not include prime ideals. You may do this construction for any scheme $X$ of finite type over a Dedekind domain.