login_url filter not working correctly with domain mapping plugin

I have a function making use of the 'login_url' filter, to use a custom user login page for sites on my network. In it I return a new login URL that I generate using the 'home_url()' function, since I determined that to be the best function to use to return the correctly mapped domain for a given site.

It doesn't work, however. My 'login_url' filter function works, since if I set it manually to another page on the site, or to google.com or something it works fine. It seems that I cannot properly use 'home_url()' (or 'site_url()' for that matter) on mapped domains when using Mercator. The function works fine for subdomains on my main network domain, just not for mapped domains.

Here is the function:

function health_login_url( $login_url, $redirect ){
return home_url('/login');
add_filter( 'login_url', 'health_login_url', 10, 2);

The expected output/effect is for the user to be directed to the /login page of the site they are on, when usually they would have been directed to /wp-login.php. This works as expected on any site where it is just a subdomain on the main network domain (e.g. subdom.networkdom.com), but does not work if there is a mapped domain (e.g. mappeddomain.com, which is mapped to subdom2.networkdom.com). The function itself works, since if I use:

function health_login_url( $login_url, $redirect ) {
return 'http://google.com';
add_filter( 'login_url', 'health_login_url', 10, 2);

for example, then when a user would usually get directed to /wp-login.php, they would instead get directed to google.com. This means it must be something about the combination of using this filter, with Mercator active, on a site with a mapped domain. I have also tried site_url(), and get_home_url() and get_site_url(), but none of them work in this instance.

Thanks in advance for your help!