Pull all codes, (all of them), lookup EACH one.
One will be the root cause.
There's a $5 code reader that works over Bluetooth with the free app Torque. I've used it for years. Do NOT leave it connected to the OBDII on a Toyota - it'll cause spurious codes. Throw it in the glove box when not pulling codes.
https://www.amazon.com/NYTKL-ELM327-OBDII-Diagnostic-Scanner/dp/B0F62RX7YV
Toyota's are staggeringly reliable, especially a 2009 Corolla - it's the same engine they've used forever, but updated with a modern ignition system. It probably didn't need coils or plugs (plugs maybe). When a coil is bad you'll get a code for that specific coil.
I'd be more inclined toward a vacuum leak in the intake downstream from the MAF sensor. Check the hose, see if there's a crack. A simple trick is to start the engine and spray anything along the intake hose - WD40, carb cleaner, brake clean, etc. If it sucks it in the engine will stumble and you've found the vacuum leak.
These are very simple engine setups, little to go sideways. And codes are pretty accurate on these engines.