PerFrom the policy unit of CBP Field Operations:
Sir
Thank you for your inquiry regarding the U.S. Visa Waiver Program.
A determination of admissibility is made at the Port of Entry by the U.S. Customs and Border Protection Officer at the time of an application for admission. This applies to every application for admission, including if the individual was recently admitted to the United States under the Visa Waiver Program (VWP).
For travelers otherwise admissible under the VWP (including receipt of a valid ESTA at time of admission), seeking only to transit the United States for a four month trip to Mexico, a visa is generally not required.
We appreciate your interest in U.S. Customs and Border Protection.
As such, contrary to many online reports, you don't accrue illegal presence in the US for being in another WHTI country beyond 90 days after having transited the US.