After the fiasco with the first working prototype, I started troubleshooting. First of all, I checked the 3D model and found no issue with it. After that I examined the printed camera body. Everything was OK there, except the distance between the hole for the main lens and the rear panel - it was half millimeter (!) longer than I had designed. I suspected two reasons for this: either the plastic absorbed water and became elongated, or the 3D printer was not calibrated precisely enough.
Water absorption was not the reason, because two other dimensions of the camera were not elongated. I did several test prints with the printer and none of them had an issue with dimensions. I became puzzled.
I gave myself a one day break and came back to the puzzle. Luckily enough, having a fresh view of the situation, I spotted the issue. I printed the lens hole edges on top of the support layers, and for that reason the edges sagged 0.5 mm below the expected height. What a tricky case!
I considered several options to solve the issue and selected the following one. I split the camera body into two parts - the body itself and the front face panel - to print them separately and later join them together.
In this way I printed the second working prototype, and since then I have had no issue with focusing. Now the focusing mechanism behaves as it should.