And still Apple hasn't even begun to migrate off from Chinese manufacturers while Samsung has shut down most of its factories in China and heavily invested into Vietnam supply chains. The only meaningful explanation is that Apple still gains a significant chunk of its margin from the China market while Samsung has lost almost all of its market share there. I'm pretty sure that Apple had a clear understanding of this kind of political risks and was willing to take it in pursuit of profit maximization.
Apple does have new manufacturing capacity in the US (state of Texas). I am not sure how long it took it took put together their present supply chain but I bet it took longer than 4 years.