Fortunately I can use my passport as ID for flying.
Actually, the problem is that NM does not require proof of legal residency or citizenship for driver's licenses and the federal government requires proof of citizenship or legal residency for flying. It may be that NM will fix the problem by having two different kinds of driver's licenses, one kind being for people who have not proved citizenship and one for people who have proved citizenship.
As I see it, a state is well within its rights to issue driver's licenses to undocumented people if it chooses to do so; that is exactly what NM has chosen to do. Undocumented people will drive whether or not they have a license although they would prefer to have a license. And, if they can get a license, then they can get proper liability insurance else they cannot. If they do not get proper liability insurance, they put everyone at risk. Also, if they get a license, that indicates that they have passed both the written and behind-the-wheel test and are probably safer drivers. So, NM does have a good reason to permit undocumented people to get licenses.