They are paying for tooling in many of these factories to help increase supply. A heap of new products in one quarter with limited supply.
All of which are challenges and costs that other manufacturers have to overcome as well.
It doesn't change the fact it's a notable drop in their profit margin.
As for it being forecast, clearly the market expected Apple to overcome the challenges more effectively than they did.