How to configure a plugin which depends on executable target in the same package?

Consider the following SPM manifest:

targets: [
  .executableTarget(
    name: "MyExec"
  ),
  .plugin(
    name: "MyPlugin",
    dependencies: [
      target(name: "MyExec")
    ]
  )
  .target(
    name: "ResultTarget",
    dependencies: [],
    plugins: [
      .plugin(name: "MyPlugin")
    ]
  )
]

MyPlugin retrieves path to MyExec as

let tool = context.tool(named: "MyExec").path
throw TheError.descriptive(tool) /// ${CONFIGURATION_BUILD_DIR}/MyExec

But I got an error at build step

${CONFIGURATION_BUILD_DIR}/MyExec" - no such file or directory.

Should I somehow add this environment variable to prebuildCommand?

UPD

I can use buildCommand as alternative and all environment variables will be set at this moment.

For what it’s worth, it worked with me by passing a string literal as a dependency instead of manually specifying product or target