I fixed this by simply doing some rearranging. The realname query seems to come before the splitting, so I:

1. Put the query after the test for tag-style string
2. Assigned the query's $string variable to the last tag, if there is one.

@@ -54,14 +54,6 @@ function userreference_realname_autocomplete_callback($type, $field_name, $entit
     }
 
     if ($string) {
-      $query = db_select('users', 'u');
-      $query->leftJoin('realname', 'rn', 'u.uid = rn.uid');
-      $query->fields('u', array('uid'));
-      $query->condition('rn.realname', '%' . db_like($string) . '%', 'LIKE');
-      $query->range(0, 10);
-      $uids = $query->execute()->fetchCol();
-      $accounts = user_load_multiple($uids);
-
       if ($type == 'tags') {
         // The user enters a comma-separated list of tags.
         // We only autocomplete the last tag.
@@ -76,6 +68,15 @@ function userreference_realname_autocomplete_callback($type, $field_name, $entit
         $prefix = '';
         $tag_last = $string;
       }
+      
+      if(isset($tag_last)) { $string = $tag_last; }
+      $query = db_select('users', 'u');
+      $query->leftJoin('realname', 'rn', 'u.uid = rn.uid');
+      $query->fields('u', array('uid'));
+      $query->condition('rn.realname', '%' . db_like($string) . '%', 'LIKE');
+      $query->range(0, 10);
+      $uids = $query->execute()->fetchCol();
+      $accounts = user_load_multiple($uids);
 
       foreach ($accounts as $account) {
         $entity_id = $account->uid;