How AI-Driven Resilience Fixes Misconfigurations and Closes Security Gaps