No - that's not right - they can't discriminate against people who have work-status, but they absolutely can discriminate against people who don't have status aka arbitrary foreign nationals.
And it would be absurd if they could not.
Also, in some cases, employers should be able to discriminate, it's totally different to hire someone on an n-month visa vs full time.
Granted, it's different if they are Green Card.
It's also perfectly normal to want to hire locals, if it can be done on a national basis, then I think for some roles, state ought to be fine as well. If state governments had a state preference for in-state nationals, that would be fine, for example.
The issue here is by far and away mostly one of transparency and efficiency - the rules should be clear and the bureaucracy should just function normally.
The fact that anything takes months, or that you need lawyers etc is a sign of dysfunction.
It should be about as complicated as getting a prescription. 'One trip to an office and done'.