When looking at the Schrödinger equation one can quickly observe that there is no reason for this differential equation to result in discrete eigenenergies unless boundary conditions, which confine the motion of a particle, are taken into account. Numerous discussions on stackexchange have covered that topic, see e.g. this one, this one or that one.
I am however wondering where the quantization of energies in the derivation of Landau levels in a 2-dimensional electron gas (2DEG) in a magnetic field comes from? To my knowledge, in this case the free electron gas is not confined in any way, but nevertheless the spectrum of the respective Hamiltonian is discrete and looks like
$$E = \hbar \omega_c \left(n+\frac{1}{2}\right)$$
where the index $n$ takes integer values, but I can't quite figure out why that is since the system was never assumed to be bound (Yes, it is true that I am limiting the system to two dimensions, but that should not change the result much as a similarly quantized spectrum arises in a three dimensional electron gas exposed to a magnetic field).
What is the fundamental reason Landau levels are discrete if it is not the boundary?