I had the same issue on my CX-5 2017 and I got it resolved by my dealership just last week by installing protectors on front coil springs. It was done under warranty, according to TSB released by Mazda (some EU one, sorry I do not have the number). My car was in range of affected VINs mentioned...
It's under Settings - Vehicle - Door Lock - Auto Door Lock Mode, and I use mode "Lock: When Driving Unlock: In Park" . There are other modes too, it's about personal preference....
You can also change door lock settings to unlock doors when selector lever is in P position. Then all you need to open liftgate while engine is ON is to stop and move selector to P position and press button for liftgate opening.
I had Check Engine Light issue on my new Mazda CX-5 KF too (2.5l petrol engine with cylinder on demand technology, G194). It happend 2 months after buying a car with around 1800km on it. I had not noticed any issue with the engine all looked normal when CEL turned on. I took it to dealership...