Sure but they have to pay legal migrants minimum wage along with adhering to other regulations. Illegal hires are cheaper and can't complain. Maybe they're "unwanted" by the government to save face but business owners profit big time, especially in agriculture and food processing jobs.
You're correct, there is a labor shortage in Thailand. Legal or not, the perfect way to fill in this gap is with desperate people fleeing danger.