Most of the undocumented didn't earn enough to be forced to do their income tax, so being undocumented or not is irrelevant for paying income taxes.
They do pay IVA like anyone else tho and your point of emergency care vs regular checkups is very valid, regular checkups are cheaper for the system.