Yes there will always be bugs but no practice or method is invulnerable to this.
Software in general, in these high risk environments, has been extraordinarily successful in terms of reliability and safety.
[1] https://sma.nasa.gov/sma-disciplines/software-assurance/2019...
I think you may need more time in the field and observing the reality here. There are unbelievably high standards and practices in many places. Maybe CRUD codebases for a consumer website has critical failures but that doesn’t really matter. People will stop using their site if it’s too large a problem.
Software is different than many technical and engineering fields. Codebases change over time as new requirements come in to extend functionality. Things can be patched. When standard engineering practices are required they are implemented. Yes, mistakes happen too but bridges fall down on occasion.