Yes, you are right.
If you do include(':D:foo')
then you are effectively creating two projects, D
and its subproject foo
.
If you don’t want that, you can do include(':foo')
and then configure its project directory to be d/foo
.
Other than that, configuring subprojects from the root project should not be done anyway for various reasons. Instead you should write convention plugins that you then apply to the projects directly where those conventions should be effective: Sharing Build Logic between Subprojects.