For a constant-coefficient case, it is guaranteed that the solutions we get from taking $e^{\lambda x}$ to be the ansatz and finding out the value of $\lambda$ are valid. Generally, for a homogeneous equation
$$ay''+by'+cy=0$$
it is equivalent to taking the linear differential operator as $$\mathcal{L}=aD^2 + bD + c$$ where $D = d/dx$, and saying that
$$\mathcal{L}y=0$$
So I would say that $e^{\lambda x}$ is a basis for the eigenspace of $\mathcal{L}$ which corresponds to the eigenvalue of $$\Lambda=a\lambda^2 + b\lambda +c$$
henceforth making the equation $\mathcal{L}y=\Lambda y$.
However, this method does not work for a nonconstant-coefficient case. But I don't see why it doesn't work. Instead of talking about general cases, I will use a specific example from now on. Consider the equation
$$y''+xy'+y=0$$
I found that it is entirely valid up to carrying out the characteristic equation.
$$\lambda^2 e^{\lambda x} + x \lambda e^{\lambda x} + e^{\lambda x}=0$$
$$(\lambda^2+x\lambda+1)e^{\lambda x}=0$$
Since $e^{\lambda x}>0$, $$\lambda^2+x\lambda+1 = 0$$
Then we can find $\lambda$ using the quadratic formula (admitting that $\lambda$ is a function of $x$):
$$\lambda_1(x) = \frac{-x + \sqrt{x^2-4}}{2},\ \lambda_2(x) = \frac{-x - \sqrt{x^2-4}}{2}$$
Since the equation is linear, we can guarantee that the span of $\{e^{\lambda_1 x}, e^{\lambda_2 x}\}$ is a solution. Thus,
$$y(x) = e^{-x/2} \times [Ae^{+\frac{\sqrt{x^2-4}}{2}x} + Be^{-\frac{\sqrt{x^2-4}}{2}x}]$$
Except for the fact that the eigenvalue $\lambda$ is a function of $x$ there is nothing peculiar about it. I thought it is fine, because what we are taking as "vectors" is the solution function $y$, not the independent variable $x$ underlying at the back of this function.
It doesn't work in your example because when you differentiated $e^{\lambda x}$ to obtain the characteristic equation $\lambda^2+x\lambda+1 = 0$, you implicitly assumed that $\lambda$ is a constant. However, if $\lambda$ is a function of $x$, then $(e^{\lambda x})'=(\lambda'x+\lambda)e^{\lambda x}\neq \lambda e^{\lambda x}.$
You can use the ansatz $e^{\lambda x}$, but in order to determine $\lambda$ you have to solve a differential equation, not an algebraic one.