The derivation of the time-independent Schrödinger equation doesn't assume both sides equal a constant. It begins with the assumption that the wavefunction can be written as a product of two functions: one depending on the coordinate and one on time.
Edit: Adding details of argument
I am assuming $\varphi$ and $\psi$ are equations of just time and just position, respectively. That is,
$$
\varphi = \varphi(t) \\
\psi = \psi(x)
$$
We have
$$
i\hbar\frac{1}{\varphi(t)}\frac{d\varphi}{dt}\left(t\right) = -\frac{\hbar^2}{2m}\frac{1}{\psi(x)}\frac{d^2\psi}{dx}\left(x\right) + V(x) \tag{1}
$$
Note that the LHS is a function of $t$ and the RHS is a function of $x$, and $t$ is independent from $x$. Assume both sides are not constant, and that equality holds for some $t_o, x_o$.
$$
i\hbar\frac{1}{\varphi(t_o)}\frac{d\varphi}{dt}\left(t_o\right) = -\frac{\hbar^2}{2m}\frac{1}{\psi(x_o)}\frac{d^2\psi}{dx}\left(x_o\right) + V(x_o) = A \tag{2}
$$
Since $t$ and $x$ are independent, if equality holds for $t_o, x$ such that $x \neq x_o$,
$$
i\hbar\frac{1}{\varphi(t_o)}\frac{d\varphi}{dt}\left(t_o\right) = -\frac{\hbar^2}{2m}\frac{1}{\psi(x)}\frac{d^2\psi}{dx}\left(x\right) + V(x) \tag{3}
$$
(2) and (3) imply
$$
-\frac{\hbar^2}{2m}\frac{1}{\psi(x)}\frac{d^2\psi}{dx}\left(x\right) + V(x) = A \hspace{2em} \forall x
$$
By similarly writing the equation for $t, x_o$ one gets the LHS of (1) to equal $A$ as well.