The installation script has to realize that in a machine with containers, there are several processes called mysqld, but they don't belong to the central session, are isolated in containers. A workaround is to stop all containers, but in busy server that is not simply possible.
Preparing to unpack .../0-mariadb-server-10.4_1%3a10.4.11+maria~buster_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
'systemctl stop mysql' returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /tmp/apt-dpkg-install-XZL55Z/0-mariadb-server-10.4_1%3a10.4.11+maria~buster_amd64.deb (--unpack):
new mariadb-server-10.4 package pre-installation script subprocess returned error exit status 1