Why do calculus textbooks gloss over absolute values? The archetypal example of this is in the equation $\frac{dy}{dx}=y.$ When solving by separation, you end up reaching the result
\begin{align*}
|y|&=C_1 e^x \\
\Rightarrow y&=C_2 e^x. \\
\end{align*}
The justification for this step, according to a lot of sources, is the fact that the + or - from the absolute value can be combined with the constant to yield a new constant. However, this falls into the pointwise trap: what prevents the function from taking the positive branch at some points and the negative branch at others? In this case, making the function piecewise destroys continuity, violating the initial differential equation, but an extra step would be needed to rigorously confirm this result.
A bigger problem arises in the case of differential equations such as $\frac{dy}{dx}\cdot \frac{1}{2}x=y,$ let's say with initial condition $(1,1).$ Again, this equation is quite easy to solve by separation of variables to yield the result $y=x^2$ as your solution - or is it? As it turns out, $y=\textbf{sgn}(x)\cdot x^2$ also satisfies the differential equation everywhere as well as the initial condition. This, to me at least, is alarming, since I've never seen these kinds of "pathological" solutions addressed in the solving of differential equations, and I can't find anything on the internet about this either, despite this being an extremely simple differential equation which has definitely appeared in textbooks or tests before. Even WolframAlpha ignores this solution and gives only $y=x^2.$ Is this something that is just commonly overlooked, or did teachers/authors think it wasn't important, or... what? I have yet to find a satisfying explanation. I have also asked my teacher, again with no satisfying answer.
 A: Since your question asks specifically about absolute values, I would like to interrogate slightly a statement from it:

When solving by separation, you end up reaching the result
$|y| =C_1 e^x$

Presumably this statement is based on something you learned in single-variable calculus, viz., that $\int \frac{1}{x} \, dx = \ln |x|$.  One thing that's being glossed over here is the meaning of this latter equation.  The expression $\frac{1}{x}$ does not define a function on $\mathbb{R}$, and so it doesn't morally have a single antiderivative on $\mathbb{R}$, as the formula suggests.  Rather, it has two antiderivatives, $\ln(x)$ on $(0, \infty)$ and $\ln(-x)$ on $(-\infty, 0)$.  And sure, one can summarize this by a single formula, but it's somewhat misleading to do so.  (In my experience calculus textbooks handle this point fine, but it's sufficiently sophisticated that it washes over most single-variable calculus students, and it would be an eccentric instructor who focused on drilling the point.)
Given the issue above, one way to view what's going on is that by the time you have reached the statement $|y| = C e^x$ you have already passed through the dodgy part of the argument, which is about what happens in separation of variables at the points where one side or the other has division by zero.  The same thing happens in the second example, where division by zero happens on both sides of the separated equation.
A: There's two possible answers to your question (at least in my mind), neither of which are particularly satisfying.
$1)$ The reason calculus textbooks gloss over the things you mentioned in your question is that they are providing a relatively simple description of the math. That is, they are teaching the math and adding that level of rigor and detail wouldn't provide a better/more useful understanding of differential equations.
$2)$ The study of differential equations can trace its roots back to solving real world physics and engineering problems. The reason the finer details might be ignored is that they simply don't matter for the vast majority of differential equations encountered in real world applications. You ask "what prevents the function from taking the positive branch at some points and the negative branch at others?" Well, reality mainly. There are not any physical processes (at least none that I can think of) that such a function would describe and so we can safely ignore such a solution.
I make no judgements on the mathematical appropriateness of either of these reasonings, just that I believe them to be the most likely answers.
A: As Angelica points out in her comment, this isn't really an answer, but it's too long for a comment.  I agree with QC_CQAOA  that the most likely explanations are those given in his or her answer.
If you only require $\ y\ $ to be at least once differentiable at $\ x=0\ $, then the general solution of your second example over the whole real line is $$\ y=\big(C_1H(x)+C_2H(-x)\big)x^2\ ,$$ where $ H\ $ is the Heaviside step function. To specify both $\ C_1\ $ and $\ C_2\ $ uniquely, you need one initial condition for some $\ x_1>0\ $ (to determine $\ C_1\ $) and another for some $\ x_2<0\ $ (to determine $\ C_2\ $).  If you require $\ y\ $ to be at least twice differentiable at $\ x=0\ $, however, then you must have $\ C_1=C_2\ $ and there is a unique solution for a single initial condition given at any $\ x_3\ne0\ $.
