The global view result counter passes itself wrapped in double curly braces when rendered, rather than as an integer value. This patch fixes that by adding a render function in Drupal\views\Plugin\views\field\Counter.php.
So, for example, a drupalist can put a global view counter and a global custom text field in a view, and then to add filters to counter in the text replacement field.
Fields:
Global: View result counter
Global: Custom text
In the custom text field:
{% if counter is even %}
... do something ...
{% endif %}
This was before not possible, as the string "{{ counter }}" was passed to the "even" filter, rather than the value of counter itself.