I know that, at the end of your code, in this loop, is where things seem to get doubled up:
foreach ($all_posts as $p):
$p->acf_fields = $all_acf_fields[$x];
array_push($all_posts, $p);
$x++;
endforeach;
If I comment that out, and print $all_posts or $all_acf_fields, it shows the right number of arrays, ie, one array for each post