If it is really just about conflicts related to compose project down and up, you can make your script wait until the project resources are actually removed:
docker compose --project-name ${PROJECT_NAME} --file compose.yml down
resource_types="container network"
for type in ${resource_types}; do
until [ -z "$(docker $type ls --filter label=com.docker.compose.project=${PROJECT_NAME})" ]; do
sleep 1
done
done
If you want the volumes to be deleted as well, add the -v argument after down and add volume to the resource_types