Unity 3D. Modified URP: Render to RenderTexture then to backbuffer

I was looking for a performant way to add a custom post-processing effect. Selective blur in particular. First I implemented it with the Render Feature by blitting the backbuffer to render texture and then blitting the render texture back to screen, but it had huge performance hit on a mobile device. I investigated it a bit further and found out that even the most basic shader has major performance impact with Render Features.

Now I’m looking for a way to modify the URP. I want it to first render to render texture, then blit the render texture with material to backbuffer and then render everything that should not be blurred with an overlay camera. I added two fields to the UniversalRenderPipelineAsset

public RenderTexture TargetTexture;
public Material BlurMaterial;

and in then the UniversalRenderPipeline in the RenderSingleCamera method I do this

            if (camera.CompareTag("MainCamera"))
                camera.targetTexture = TargetTexture;
                var cb = CommandBufferPool.Get();
                cb.Blit(TargetTexture, null as RenderTexture, BlurMaterial);
            using (new ProfilingScope(cmd, Profiling.Pipeline.Context.submit))
                context.Submit(); // Actually execute the commands that we previously sent to the ScriptableRenderContext context
            if (camera.CompareTag("MainCamera"))
                camera.targetTexture = null;

This works quite well, the performance is much better than what it was when I used Render Feature.

The only problem I’m facing now is that if I add an overlay camera with a layer mask in order to render the car interior on top of the blurry image, the blur stops working and everything is rendered as usual. Nothing gets blurred.

You can see on the image above the Overlay Camera has Culling Mask set to Player, but the whole blur effect is discarded if enable the Overlay Camera.
I’d be glad if someone could shed some light on why this happens and how I can fix this. It’s the second day I’m struggling with this and still have no clue.