I'm not convinced that the filter function can be shared between the layer manager and the catalog tree. The layer manager will indeed include layers that the catalog tree don't have.

Also, the gaLayers service provides an API for the "layers config". The getLayerFilterFunction function would be an exception.

In that particular case (layer removal), could the catalog tree just checks if the layer exists in the "layers config" (using gaLayers.getLayer)?