According to numerous online reports (including screenshots of correspondence with the CBP Info Centre), a VWP national who enters the US by air solely in transit to Canada or Mexico, and then spends over 90 days in Canada/Mexico, unless a resident of Canada/Mexico, will be in violation of the VWP, refused re-entry to the US and barred from future travel under the VWP.
Is this really correct? It would imply a VWP national wishing to spend e.g. 4 months in Mexico would need a tourist/transit visa for the US if both the trip to and from Mexico takes place with a flight connection in the US. This would frankly be ridiculous.
My understanding is instead that stays in Canada/Mexico do not count towards the VWP admission duration on an automatic, strictly binding basis (as the reports suggest); rather, if the stay in Canada/Mexico is sufficiently short that it can reasonably be considered a mere side trip from the US, the CBP is likely not to grant a new 90-day admission period, but only the remainder of the original 90 days.