One can explain TSMCs preferential treatment for Apple based on purely commercial terms. Apple is after all the biggest foundry services consumer and they usually demand the advanced nodes which tend to be more expensive.
But there is no such explanation for TSMCs preference for Mediatek over Qualcomm. Qualcomm is generally as large as Mediatek, in fact they used to be significantly larger before TSMC hobbled them.
Well the first explanation that leaps to mind is patriotism (mediatek is a taiwanese company like TSMC, Qualcomm is American). But if that plays a significant factor then perhaps the chipmakers of the world should not so eagerly trust TSMC to make their chips.