Why are there .htaccess and php files in ./sites/default/php/twig Just wondering, it may be related to cache settings, but why are there lots of php and .htaccess files in the public:// dir?
The PHP files are compiled Twig templates and the .htaccess file protects them from public access. You can switch off the caching of compiled twig templates by setting this service parameter to FALSE.

# Twig cache:
#
# By default, Twig templates will be compiled and stored in the filesystem
# to increase performance. Disabling the Twig cache will recompile the
# templates from source each time they are used. In most cases the
# auto_reload setting above should be enabled rather than disabling the
# Twig cache.
#
# Not recommended in production environments
# @default true
cache: true


You find this in sites/default/default.services.yml, which you have to rename to sites/default/services.yml to activate it.