Individual doctors working for a clinic are paid a flat salary, true - but the clinics themselves, or the small doctors running their own office are absolutely dependent on accurate billing to the insurances. They have an incentive to optimise their margins, even if patients are not paying directly, and that means both trying to spend as little on care as possible while getting back as much as possible from the insurance providers.
It sounds like you’re describing a country with a public-private hybrid system. Certainly in the UK and the Nordics, the systems I’m most familiar with, there is no “getting back as much as possible from the insurance providers”, as there are no insurance providers. The hospitals are run by the government, funded by regional governments, and have fixed yearly budgets, not treatment dependent billing. The only exception is some privately run GP clinics that may bill per service rendered.