Yes that is correct. I have noticed that first time after changing the coils and plugs, the ECU threw camshaft position sensor error code P0340 even though my camshaft position sensor is brand new and works great. The reason was that due to undercharged battery, the car took longer than normal to start and the ECU thought this to be the reason. I recharged the battery and cleared that trouble code. Now it starts in like half a second with no error codes Alhamdulillah.
I would say one should never blindly rely on the ECU error codes because sometimes they are not actually the main cause of problem. Problems could lie somewhere else which results in these codes. For example, a vacuum leak in the intake manifold could throw a MAP sensor low voltage error code, and if you decide to replace that without checking around for actual reason of the code, you'll spend 12K and the problem will still persist!