The mentioned files must not be altered. They are part of the server core and are fine as they are.
You are writing an app that needs a looser csp setting than normal (pure NC) apps need. So, read the documentation. There is an example on allowing all domains. I would highly suggest to whitelist individual domains to minimize the security impact.
Did you check your web server doesn’t have CSP policies itself (.htaccess, .conf…). You can check by accessing through a page that isn’t generated by Nextcloud (eg test.php).