If user is already logged in, /wp-login.php redirects them back to my home page

I finally fixed an error where only some of my users were getting redirected to their wp-admin area after logging in. Now ALL users are getting redirected to their wp-admin area after logging in.

Now I am having an issue though where if the user goes to wp-login.php while they are already logged in, it automatically redirects them back to my home page instead of their subsite wp-admin area. Can you please help?

Here is the mu-plugin code that I am using to currently redirect users after login. Can you add some code to this so it fixes the issue I listed above?

<?php
/*
Plugin Name: Redirect Users to Primary Site
Plugin URI:
Description: Never see "you do not currently have privileges on this site" when logging in on your multisite ever again!
Version: 2014.06.02
Author: khromov
Author URI: https://profiles.wordpress.org/khromov
License: GPL2
*/

/* https://premium.wpmudev.org/forums/topic/redirect-users-to-their-blogs-homepage */
add_filter('login_redirect', function($redirect_to, $request_redirect_to, $user)
{
if (!is_wp_error($user) && $user->ID != 0)
{
$user_info = get_userdata($user->ID);
if ($user_info->primary_blog)
{
$primary_url = get_blogaddress_by_id($user_info->primary_blog) . 'wp-admin/';
if ($primary_url) {
wp_redirect($primary_url);
die();
}
}
}
return $redirect_to;
}, 100, 3);
?>