diff --git a/src/PluginInit.php b/src/PluginInit.php
index a94e90989c54cdcc011dbd4b3722b498c31087b0..31942941da6e95a1c770edeae5fbc73ef6b8e56f 100644
--- a/src/PluginInit.php
+++ b/src/PluginInit.php
@@ -75,7 +75,7 @@ final class PluginInit {
 			$this->filename = $backtrace[0]['file'];
 		}
 
-		$cache_path = $this->config->get( 'cache_path', 'generated' ) . '/plugin.php';
+		$cache_path = $this->get_cache_dir() . '/plugin.php';
 		try {
 			$plugin_data = $this->loader->load( $cache_path );
 		} catch ( \Exception $e ) {
@@ -95,6 +95,10 @@ final class PluginInit {
 		return $plugin;
 	}
 
+	private function get_cache_dir(): string {
+		return $this->filename . '/' . $this->config->get( 'cache_path', 'generated' );
+	}
+
 	private function initialize_container( Plugin $plugin ): Container {
 		$original_builder = new DiBuilder();
 		$builder = new ContainerBuilder( $original_builder );