EntityQuery PHP issue when assigning the query to a variable
Objects work differently than regular variables in PHP. They are &quot;assigned by reference&quot;, generally speaking. The Objects and References page in the PHP manual goes into some detail about this. Basically, your = is not working as you expect. $entity_query and $entity_query_points1 are &quot;the same object&quot;.
As noted by @baikho in the comments, you'll need to use clone to achieve what you're trying to do.
$entity_query = clone $entity_query_points1;