My DPE told me it is not his job to check immigration requirements, and he never did.
Our school did, on the last day it was open, get a visit from TSA and CBP checking passports and visas. And I can 110% tell you, anyone found there doing flight training without a visa would have been in trouble.
So: No, you probably won't get caught but Yes, it is illegal.
This "incidental to visit" has been discussed ad nauseam. TSA views, that if you get flight training with intent to get an initial FAA certificate or a rating, it is flight training and thus you are required to have the correct visa for it.
If you want to risk it, go ahead. I'd guess 99% of people who do that, get away with it just fine. The IACRA etc has no clue about your immigration status, and it seems TSA doesn't routinely check it either, even though they say they do.