Those are options for the mariadb program itself. You can put them in configuration files, overriding what is already set, e.g. on my system:
$ sudo ack datadir /etc/mysql/ /etc/mysql/mariadb.conf.d/50-server.cnf 21:datadir = /var/lib/mysql
So I would suggest making your own custom config file in /etc/mysql/mariadb.conf.d/ numbered after 50 and override it there:
[mysqld] basedir = /usr/local/mariadb datadir = /data/mariadb
Do bear in mind that the installation of the mariadb Debian package will create some databases in the default location first as part of its setup. You may want to pre-create your config files (which the install won't overwrite) so that it gets the correct settings at first startup and during the initial configuration.
Also mariadb doesn't currently have an AppArmor profile in Debian at the moment but it could grow one, so you'd have to watch out for that as it's very likely to restrict the daemon to only being able to access /var/lib/mysql.