I've managed to fix this one query I think:
INSERT INTO `foo_PROD`.`images`
SELECT
id,
vid,
IF(
(container_cdn_uri REGEXP ('^http://[a-z0-9\\-]+\\.r[0-9]{1,2}\\.cf1\\.rackcdn\\.com')),
CONCAT("https://", MID(container_cdn_uri, 8, (LOCATE(".r", container_cdn_uri) - 8)), ".ssl.cf1.rackcdn.com"),
container_cdn_uri
),
container_name,
root_filename,
filename_extension,
is_default,
time_added,
original_width,
original_height,
remote_url_hash,
time_added_local,
3
FROM `bar_prod`.`images`;
The trick is escaping the escape character.
That said, I'm still wondering if anyone has thoughts about MariaDB versus MySQL. MariaDB is supposed to be a drop-in replacement for MySQL, but as we see with this problem here, it is not. I wonder if there might be other problems (performance? lack of features?). Seems like we're balancing potential flakiness of a community version of the db engine against the potential evil of Oracle, who know owns MySQL.