You should consider replacing the fuel filter while you're in there.
A clogged fuel filter can cause fuel pressure issues and strain the fuel pump.
https://mazdas247.com/forum/t/how-to-change-your-fuel-filter-lots-of-pics.123829616/
One last thing I can think of is your intake tube.
I don't even know if the intake tube is used with your CAI, but on my car it involved the STFT and the LTFT, so it might be something to look at.
It was 10 years ago, so my memory is a bit foggy...
I'm just speculating but if your car is burning oil (like just about every P5) then you could have thick carbon buildup on your pistons.
If a piece of carbon breaks off and gets caught between the piston and spark plug, it could close the gap. That stuff is rock hard.
Maybe try and look...
I remember thinking that the manual transmission could make more power than the automatic, but apparently the automatic can make more power.
I remember an upgraded forged gear set for the manual transmission that cost $7,000 US just for the set of gears.
I know that the car REALLY sucks gas.
My brother-in-laws 2019 Dodge pickup truck gets almost as much MPG with its 5.7 liter V8 engine.
It is 20 years newer, but still...
Just wait until your car goes into limp mode from engine misfiring.
Then it gets even worse.
One thing I remember is that...
The only other thing that I can think of is the relearning process of the IAC when the battery is disconnected.
My car will almost stall every time the battery is disconnected.
https://mazdas247.com/forum/t/p5-rough-idle-help.123871922/#post-6687154
It may just take some time to relearn?
Don't forget about the P5 wiring diagram download,..
https://www.floptical.net/mazda/
My book has a few things that are missing from the download, including the headlights.