Finally I figured out what went wrong and how to solve this:
Within the Zend\InputFilter\Factory that I used as InputFactory a defaultFilterChain is created from scratch which generates a new FilterPluginManager that does not get the service manager's filters.
To solve this I insert a factory for the entity filter into the service manager which injects a defaultFilterChain with filters of the service manager:
'EntityFilter' => function($sm) {
$filterManager = $sm->get('FilterManager');
$filterChain = new FilterChain;
$filterChain->setPluginManager($filterManager);
return new EntityFilter($filterChain);
}
Within the getInputFilter method of the filter class EntityFilter this is inserted into the InputFactory:
$factory = new InputFactory();
$factory->setDefaultFilterChain($this->defaultFilterChain);
Now the InputFactory can also use these filters of the service manager's filter manager that includes myfilter.