After you edit and save your custom code are you activating Root folder BulletProof Mode again? Activating Root folder BulletProof Mode writes your saved custom code to your root htaccess file. If you are activating Root folder BulletProof Mode and the W3TC htaccess code is being changed in the root htaccess file then W3TC is automatically writing to the root htaccess file and changing your root htaccess code directly in the root htaccess file.