check if a route segment matches a section entry type
Take a look at the {% exit %} tag. You should be able to do something very similar, since your search will return no results if the entry type does not exist.

{% set entries = craft.entries.type(craft.request.getSegment(3)).relatedTo(category) %}

{% if not entries %}
    {% exit 404 %}
{% endif %}