You may define a locally ringed space $(X,\mathcal{O}_X)$ with $X:=\mathbb{P}^1_{\mathbb{R}}$ the real projective line in the sense of "real algebraic geometry", and the topological space $X$ is by definition the space of $\mathbb{R}$-rational points of the projective scheme $Proj(\mathbb{R}[x_0,x_1,x_2])$ with the induced topology. The structure sheaf $\mathcal{O}_X$ is discussed below. You may construct a closed embedding
$$ i:\mathbb{P}^1_{\mathbb{R}} \rightarrow \mathbb{A}^d_{\mathbb{R}}$$
where $\mathbb{R}^d_{\mathbb{R}}$ is affine $d$-space in the sense of "real algebraic geometry". The embedding $i$ exists because of regular functions of the type
$$\frac{1}{x^2+y^2+1}.$$
Hence the "real projective line" (and more generally the "real projective space") is affine and algebraic.
Remark: "It turns out that this seems to be false if $K$ is not algebraically closed: take $K=R$ and look at the projective line $P^1_R$ and the rational function $f=\frac{x^2_0}{x^2_0+x^2_1}$ where $(x_0:x_1)$ are projective coordinates on $X$. It is non-constant and regular everywhere."
Answer: You may use functions like $f$ to construct an explicit "algebraic" embedding as follows:
$$i: \mathbb{P}^1_{\mathbb{R}} \rightarrow \mathbb{A}^3_{\mathbb{R}}$$
defined by
$$i(x:y):=(\frac{x^2}{x^2+y^2}, \frac{xy}{x^2+y^2}, \frac{y^2}{x^2+y^2}).$$
You may check that $i$ is well defined and a "closed embedding". You are propably aware that $Proj(\mathbb{R}[x_0,x_1,x_2])$ cannot be realized as an affine variety/scheme.
Note: There is nothing "naive" about this defintition as is being claimed: "real algebraic geometry" is an independent field of research.
At this link you find s discussion of the ringed space $(X,\mathcal{O}_X)$:
https://math.stackexchange.com/posts/3984082/edit
If you define $\mathcal{O}(\mathbb{A}^1_{\mathbb{R}})$ as the set of functions with the following property (P1):
P1. $f: \mathbb{R}^2 \rightarrow \mathbb{R}$ with the property that for any point $p\in \mathbb{R}^2$ there is an open subset $U(p)\subseteq \mathbb{R}^2$ and two polynomials $p(x),q(x)\in \mathbb{R}[x]$ such that the restriction $f_{U(p)}$ of $f$ to $U(p)$ satisfies $f_{U(p)}=\frac{p(x)}{q(x)}$,
then it follows (as you noted) the function $\frac{1}{x^2+1}$ is a regular function on $\mathbb{R}^2$. Hence $\mathcal{O}(\mathbb{A}^1_{\mathbb{R}})\neq \mathbb{R}[x]$. If $z=a+ib \in \mathbb{C}$ with $b\neq 0$, it follows
the polynomial $p_z(x):=(x-z)(x-\overline{z})=x^2-2ax+a^2+b^2\in \mathbb{R}[x]$ is an irreducible polynomial - it has no real roots.
Hence if you use definition P1 to define the ring of regular functions, it follows the function $f(x):=\frac{1}{p_z(x)}$ is a regular function. If $S\subseteq A:=\mathbb{R}[x]$ is the set of polynomials on the form $p(x):=\prod_{z_i\in \mathbb{C}-\mathbb{R}} (x-z_i)(x-\overline{z_i})$ it follows $S$ is a multiplicatively closed subset, and the ring of fractions $S^{-1}A$ is a sub-ring of $\mathcal{O}(\mathbb{A}^1_{\mathbb{R}})$. Hence with definition P1 it follows the ring $\mathcal{O}(\mathbb{A}^1_{\mathbb{R}})$ is much larger than $A$.
Question: "The regular functions on $\mathbb{A}^n$ are exactly the polynomials in n variables [...], which I only agree with for K
algebraically closed and not in the case I've shown above."
Answer: You want (for many reasons) to recover the polynomial ring $\mathbb{R}[x]$ as the ring of global sections of the structure sheaf. This problem is "solved" by the affine spectrum $Y:=Spec(\mathbb{R}[x])$. What you define above is a "sheaf of rings" on the real algebraic variety $\mathbb{A}^1_{\mathbb{R}}$ in the sense of "real algebraic geometry", and this sheaf differ from the sheaf defined using the affine spectrum in the sense of Hartshornes book "Algebraic geometry". The topological space of the variety $X:=\mathbb{A}^1_K$ you consider above is the set of real numbers $r\in \mathbb{R}$. The topological space of $Y$ consists of all real numbers plus the set of all maximal ideals in $A:=\mathbb{R}[x]$ with residue field the complex numbers. Hence the two topological spaces differ. Your space $X$ is by definition the set of rational points $Y(K)$ with the induced topology.
Note: There is nothing "wrong" with the ringed space $(X, \mathcal{O}_X)$ - it has properties different from $Y$. In real algebraic geometry it follows projective space $\mathbb{P}^n_K$ may be realised as a real affine algebraic variety - there is a closed embedding into real affine space. Moreover any real projective variety is affine. The reason for this is that the structure sheaf has more local sections, as you have observed in your comment above. Hence there are "more maps". This does not happen with the Hartshorne definition: You cannot construct a closed embedding of $Proj(k[x_0,..,x_n])$ into
affine space $Spec(k[y_1,..,y_d])$.
As an example: The global section $s(x):=\frac{1}{p_z(x)}$ for $z\in\mathbb{C}-\mathbb{R}$ is a unit - the polynomial $p_z(x)$ is non-zero on $\mathbb{R}$, and with your definition of "regular map" it follows $s(x)$ is a global section - it lives in $\mathcal{O}_{\mathbb{A}^1_K}(\mathbb{A}^1_K)$. The function $s(x)$ is not a global section of $\mathcal{O}_Y(Y)\cong \mathbb{R}[x]$.
Real algebraic varieties are relevant for people studying complex algebraic varieties and their topology. You may for any complex projective manifold $X \subseteq \mathbb{P}^n_{\mathbb{C}}$ construct the Weil restriction $W_{\mathbb{C}/\mathbb{R}}(X)$. If $dim(X)=d$ it follows $dim(W_{\mathbb{C}/\mathbb{R}}(X))=2d$ and $W_{\mathbb{C}/\mathbb{R}}(X)$ is a smooth scheme over $\mathbb{R}$ - the "underlying" real algebraic variety of $X$. The variety
$W_{\mathbb{C}/\mathbb{R}}(X)$ has the same topology as $X$ and you may realize $W_{\mathbb{C}/\mathbb{R}}(X)$ as a real affine algebraic variety. Hence the "underlying" real algebraic variety of $X$ is affine. Moreover: Any real affine algebraic variety may (topologically) be realized as a hypersurface. Hence if you study the topology of $X$ it follows there is in some cases a real affine hypersurface $Z(f)$ with the same topology as $X$ (here I am extremely "vague"): If $X\subseteq \mathbb{P}^N_{\mathbb{C}}$ is a complex projective variety of dimension $d$
there is a polynomial $f\in \mathbb{R}[y_1,..,y_{2d+1}]$ with the property that $X$ and $Y:=Z(f)\subseteq \mathbb{A}^{2d+1}_{\mathbb{R}}$ have the "same topology".
Exampl. If we consider the complex projective line $X:=\mathbb{P}^1_{\mathbb{C}}$ and it's "underlying" real algebraic variety $X(\mathbb{R})$,
there is an isomorphism
$$X(\mathbb{R}) \cong Z(f)\subseteq \mathbb{R}^3$$
where $f:=x^2+y^2+z^2-1\in \mathbb{R}[x,y,z]$. Hence the complex projective line, viewed as a real algebraic variety, is isomorphic to the real 2-sphere and in this case we may give an explicit realization of $X(\mathbb{R})$ as a hypersurface in $\mathbb{R}^3$. To construct such an explicit isomorphism we need functions on the form $f(t):=\frac{1}{t^2+1}$ and $g(x,y):=\frac{u(x,y)}{x^2+y^2}$.
You find this discussed here:
https://math.stackexchange.com/posts/3957121/edit
and here:
Different definitions of regular map (between affine varieties)?