I think you can simplify the patch a bit by inheriting the source too:

(source
(origin
(inherit (package-source mariadb))
(patches …)))

Otherwise, untested but looks good.