It's very unexpected behavior for docker compose IMHO. When you say the volume is named "foo" it creates a volume named "directory_foo". Same with all the container names.
You do have some control over that by setting a project name. So you could re-use your old volumes with the new directory name.
Or if you want to migrate from an old volume to a new one you can create a container with both volumes mounted and copy your data over by doing something like this:
docker run -it --rm -v old_volume:/old:ro -v new_volume:/new ubuntu:latest
$ apt update && apt install -y rsync
$ rsync -rav --progress --delete /old/ /new/ # be *very* sure to have the order of these two correct!
$ exit
For the most part applications won't "delete and re-create" a data source if it finds one. The logic is "did I find a DB, if so then use it, else create a fresh one."