I've seen a few others having this issue but the forums closed without solutions so I feel I have to share my fix.
For my Zenfone 9 I randomly couldn't connect to cellular data on T-Mobile, after having it connected for months. Other sims worked in the phone, calling and sms worked, the sim worked in other phones.
After a long list of troubleshooting shooting the APN, swapping sim cards, calling T Mobile, etc, it turned out because I was not using the default messenger for texts (Signal instead) I was not getting the message to give the phone access to the network after an update changed it most likely. Swapping the default sms back, and reseating the sim card fixed it.