How to default dependency version to match plugin version

How can I default the version of a dependency to match the version of a plugin?

I want to emulate the dependency version defaulting that the kotlin plugin provides for my own plugin.