The equation $y'=\frac{2y}x$ has the obvious solution of $kx^2$, which exists for all reals, regardless of the values of $k$. This having been said, it is obvious via the differential equation that $y'(0)$ is undefined, which creates some oddities in creating numerical solutions to the curve. To be brief, my question is as follows:
Seeing as $y' = \frac{2y}x$ does in fact have the solution $kx^2$, and that $\frac{d}{dx}(kx^2) = 2kx$, why does the first formulation fail to fully explain the solution curve, and is one more "correct" than the other in terms of both accuracy and mathematical precedent?
A key thing in differential equations, which is sometimes glossed over is that in order to specify a differential equation and its solution, the domains have to be stated explicitly. This is usually clear from context, but let me spell out what kinds of details are (sometimes) left implicit in a discussion of ODEs. In the present example, let $U = \{ (x,y) \in \mathbb{R^2}: x \neq 0\}$, define the function $F: U \to \mathbb{R}$ by \begin{equation} F(x,y) = \dfrac{2y}{x} \end{equation} So the differential equation we wish to study is $y'(x) = F(x,y(x))$. By definition, a solution to this differential equation is a function $y: I \to \mathbb{R}$, where $I$ is an interval in $\mathbb{R}$ such that
Notice that lot of conditions have to be satisfied before we can call something a solution. First we need to specify a function $y$, which automatically means we have to specify its domain $I$, and target space. Next, we need to ensure that condition ($1$) is satisfied. BTW, note that condition ($1$) is not superfluous, it is absolutely essential to ensure that condition ($2$) makes sense (because otherwise $(x,y(x))$ will not be in the domain $U$ of $F$, so the RHS is not defined).
So, in your specific example, for every $k \in \mathbb{R}$, we can (for example) define a function $y_k:(0, \infty) \to \mathbb{R}$, by \begin{equation} y_k(x) = kx^2 \end{equation} Then it is easy enough to see that conditions ($1$) and ($2$) are satsfied. Notice how I purposely excluded $0$ from the domain of $y_k$. When you said
what you probably had in mind was the function $g_k : \mathbb{R} \to \mathbb{R}$, defined by $g_k(x) = kx^2$. Notice that even though $g_k$ and $y_k$ follow the same rule, they are strictly speaking different functions because their domains are different; and this makes all the difference, because for $g_k$, condition ($1$) is not satisfied, hence it is NOT a solution of the ODE above.
It is precisely to avoid issues/confusions you raised that we sometimes have to pay close attention to how things are defined, and to be cautious of domains etc. But once you are comfortable with keeping track of all these details, you can stop explicitly mentioning all of this, as long as there is little chance for ambiguity.