(preabmle: the following won't actually give you a working Gmail+Exhange+Mail.app solution, because, as it turns out, m.google.com is not a true Exchange server and is missing some stuff Mail.app expects)
Go to /etc/hosts and map gmail.com, imap.gmail.com, ns1.google.com, ns2.google.com, ns3.google.com, ns4.google.com to some arbitrary IP:
172.23.53.230 gmail.com
172.23.53.230 imap.gmail.com
172.23.53.230 ns3.google.com
172.23.53.230 ns4.google.com
172.23.53.230 ns1.google.com
172.23.53.230 ns2.google.com
(might not be needed to do that for all of those but I did and it had an effect)
That way, when you add an account with an e-mail address in the form of username@gmail.com, Mail.app will fail to auto-detect that it's Gmail.
It will then complain, but when you press Continue, you can manually choose the account type to be Exhcange. You then change the server to m.google.com and add the @gmail.com suffix to the user name.
Before pressing "Continue" you comment out the /etc/hosts hack lines. Mail.app then successfully sets up your Gmail account as an Exchange account.
However, as noted in the preamble, it won't work—as soon as you try to sync the mailbox, it'll just try to sync for a long time and then nothing will happen. —I'm just posting it here for those who are curious/like hacking, and in case m.google.com implements the missing Exchange features at some point and Mail.app doesn't get updated immediately.