Everything works fine when the site is in the DocumentRoot (the normal configuration).
When I use the Alias directive, W3TC tries to adjust .htaccess in the wrong directory.
In my case, DocumentRoot goes to a completely different directory on the server. WordPress is served from the Alias.
Looks like W3TC checks the DocumentRoot from the environment variables. Instead, it should use the WP variable that says where WP is installed.