This looks like a bug for me but you can use path
variable to check if its actually a page template e.g.
{% if path is defined %}
Don't let the content of the path variable confuse you its the location of the content page in the phpcr tree so it does not represent a url. In some cases it does match the url. In most cases the path variable is a good way to check if a page is a child of another page also if you use other resourcelocator strategies as the default tree one.
e.g. if you create a navigation:
{% for page in sulu_navigation_root_tree('main') %}
{% set addClass = '' %}
{% if page.path starts with path|default() %}
{% set addClass = 'is-active-parent' %}
{% elseif page.uuid == uuid|default() %}
{% set addClass = 'is-active' %}
{% endif %}
{# ... #}
{% endfor %}