Current assembly lines run tight schedules; shipping components adds significant lead time and risk. Another option is to automate the production lines extensively, which targets the labor cost but doesn't fix the component supply issue. The Chips Act may help, but for now, lead time from suppliers is going to be a challenge and a risk.
There's one big problem with Mexico though, it has nowhere near the population of China and India. It's unclear if Mexico even has large enough population centers (outside of Mexico City) to staff a Foxconn factory. Mexico has a single mega-city and 12 mid-sized cities with populations between 1-2 million. Compared to China and India, these mid-sized cities may simply not have enough workers. China has over 50 cities with populations over 2 million. Shenzhen (Foxconn HQ) has a population of 17 million, which is 90% larger than Mexico City. Trying to relocate a single assembly line from an area with 17 million people to an area with 2 million is going to create staffing challenges. To give a high-level view, Mexico's entire labor force is around 59 million, with a labor participation rate around 70%, so that means 42 million total available workers. Foxconn has approximately 800,000 employees. So if everything moved to Mexico, Apple would (indirectly) employ 2% of Mexico's labor force. Mexico's unemployment rate is currently quite low, so even hiring those employees away from their current employers could be problematic from a cost-advantage perspective.
Insanely high levels of automation (like Musk is trying to achieve within Tesla) are probably the best bet for moving manufacturing out of China and India. If we can get to high-dexterity polyvalent robotics, it's not impossible that these assembly lines could be onshored, but I'm guessing we're still 8-10 years away from assembly robots that can handle miniature component assembly with enough dexterity and complexity to be a viable alternative to human assemblers. Ironically, Apple's disassembly robots could be precursors to future assembly robots, however taking something apart is orders of magnitude easier than assembling something.