Why do I get an error after adding a .theme file?
I suspect that your .theme file was not actually empty. Please try the experiment again and check the file size. If it is 3, then your file starts with a Unicode byte order mark (BOM). 

The BOM is typically invisible in editors, but it gets sent to the browser before Drupal internally calls the header() function. This causes the error message you have seen.

From a glance on your paths, I would not conclude that the OPcache plays a role here.