New possible feature for docker-compose - depended build

Hello I am using docker-compose 3.4+
I use docker-compose file for microservices building and running
I stacked with small issue.

For example I have api-gateway service which provides interfaces (files) of nested services which listed in same docker-compose.yml
IMHO would be good to build in these files into parent image and reuse it for child services.
I have to do it now in this way:

docker-compose build gateway (interface files are included into docker image named “gateway”)
docker-compose build myservice (these service using Dockerfile with from as “gateway” and considers that image exists and interface files inside of it are being up to date)

Is it good idea to add “depends_on” feature for builds?
Or is there any other solution to achieve same result?

Thank you!