After you bump the MariaDB image to a new major version, the system tables in the mysql schema are still in the old format. The server starts anyway and then logs warnings until someone runs mariadb-upgrade.
The official image can do that step on its own:
services:
db:
image: mariadb:11.4
environment:
MARIADB_AUTO_UPGRADE: "1"
On start, the entrypoint checks whether the data directory came from an older version. If so, it starts a temporary server, writes a backup of the mysql system database to a file named like system_mysql_backup_<old version>.sql.zst in the data directory, runs mariadb-upgrade and then starts normally. That is how the entrypoint script of the image works, and the Docker Hub page describes it too.
It also creates the healthcheck user if the volume is older than that feature, which is why I’d turn it on for existing volumes.
That small backup covers users and grants, not your own tables. Take a real dump before you change the image tag. And skipping major versions is still a risk the variable cannot fix, so read the release notes for each step. If you want no upgrade backup at all, MARIADB_DISABLE_UPGRADE_BACKUP=1 turns it off, but I would leave it on.
Further reading: mariadb on Docker Hub, mariadb-upgrade