If you have version 12.0.0
then you can probably hack this by dumping your databases, manually uninstalling mysql-server, installing mariadb-server and re-importing the data. This would be an unsupported action.
The official way would be to move the databases to another server, remove and re-install the database role then move them back.