Sometimes poor development environments are a reflection of culture. If that is the case only a leadership solution will set things on a more productive direction. In cases where leadership is present and engaged a poor development environment is the result of missing technical guidance, which is likely due to a disconnect between a plan and actual implementation reinforced by developer driven decisions. Developers should never drive the direction of a product unless they are stakeholders with liability.
Just to be clear I am not a software leader. I am just an individual contributor, so take this with a grain of salt. I am a military officer though, in a secondary line of work, with director level responsibility and a large staff.