A compose file with Postgres in it is not a Postgres backend
Grafana uses SQLite unless GF_DATABASE_TYPE says otherwise, even with Postgres running next to it. Postgres is then only a data source while dashboards sit in a file on the Grafana volume. Here Grafana's database settings point at the bundled Postgres from the start.