Right. Apple who has one of the most sophisticated supply chain and production management operations in the world, yet has no clue about the most efficient ways to build it, and only tariffs will suddenly make them realize it.
Tariffs change the inputs to the decisions. Before the costs of robots was greater than cheap labor in China so Apple made the correct decision to not invest in them. After the tariffs Apple needs to revisit the decisions of the past to account for a new world where labor in China isn't as cheap. I cannot tell you what decisions Apple will make, only that they will reconsider the decisions of the past in light of new information. (don't forget new information also accounts for whatever advancements in robotics have been made since they last looked at this decision)
Note that Apple is not required to create robots to build in the US. It is an option they have, but there are other options as well. I would expect Apple to be smart enough to consider all options. The obvious alternatives to consider are move the factory to some other country; or have consumers vote against the tariff by showing how much cheaper the iPhone is elsewhere; there are probably more options I haven't thought of.