There is one health analyzer rule in SharePoint that looks for inconsistencies in web.configs of web application and it automatically repairs it.

You just have to uncheck that auto-repair on this rule.

  • Go to Central Administration
  • Monitoring
  • Review Rules Definition
  • Under Configuration Category there is a rule that says "Automatic Update setting inconsistent across farm servers"
  • Click this -> Edit Item
  • Uncheck Repair Automatic
  • Save changes