If I understand correctly you are trying to work with "local datasources". This is something well known in SXA, but if you are not using that in your project it can be a bit tricky. A few years ago I created a module to help you with that. I can not guarantee that everything will work in your Sitecore version as the module is already a few years old (build for 8.2) but it's open source so you contribute or just use the code as a starting point for your needs.
The blog post about the local datasources module will give some more insights. The code can be found on GitHub: https://github.com/Gatogordo/LocalDatasources where you can also check the readme page on how to use it.
The solution consists of several parts:
- The first part will create the actual datasource item (and the data
folder if that does not yet exists - datafolder will be pushed as
latest child). The template name of the required datasource is used
as base for the item name, combined with a number. This is all configurable on the rendering based on the settings of the datasource template and location.
- A second part will prevent the "Select the associated content" dialog
- Some support for working with branches was also added
This is not an ootb solution but if you don't have SXA included in the project it can help you achieve what you are looking for.