The companies are doing this "unknowingly". Of course they're not stupid, they're fully aware they're hiring a lot of undocumented people. But nobody, on record, knows that. To them, all their employees have documents which appear valid. It is pretty easy to forge I-9 documents.
Part of this is because the US has incredibly poor identification infrastructure. Often, not even US citizens can be reliably identified, as seen in commercial banking. The other part is that companies cannot choose to not hire people because they think they are undocumented. You can't hire someone because they're too brown and not American sounding enough.
That's not to say that I think the solution is universal identification or legalization of racism in hiring practices.