Sure there are air holes they are just directed to the outer section of the motor rather than the windings.
The magnetic field would still cause a problem as the fines would clog the cooling fins and the motor would overheat. On bench grinders the vent is underneath and away from this problem also the shields deflect the swarf.
Occasionally this is a problem on table saws but that is sawdust and easily blown away, no where near the mischief the grinding dust would cause.