Except the extra array() over $results_separated, in my case I had to apply
if (!$query->is_main_query()) {
return $query;
}
at the top of my function (found it in, otherwise, queries inside would be executed for several times and not properly.
Comments in the answer helped me to figure this out.