In MAMEUI, you can filter mechanical games already. Right click the folder you want filtered and check Mechanical. By filtering Mechanical, it removes 8003 games from the All Games list.
I too would like to see a way to compile MAME without all of these games.