Using a rendertexture as a parameter in the Render Graph system

Following the official guide for drawing objects with the new SRP system: Unity - Manual: Draw objects in the render graph system in URP

I’m trying to create an effect where two renders of the scene are created, one with all objects and another with a specific layer excluded - once both are rendered to separate RenderTextures, the difference of the two is output to the final render target using a shader that has both textures as parameters.
Essentially draw Layers A and Layers B and then output A.rgb - B.rgb

I’ve been able to modify the code in the guide to draw specific layers, but I can’t find any examples of how to use the new Blit API to do anything other than blit from one source texture to the screen.

Ideally I’d want to use the existing Render Objects render feature but you don’t seem to be able to have that output to a specific render texture.

The samples show how to do that.

Following the samples for blitting to a global render texture for later use in the frame, it seems like you should be able to just do this:

This is on a renderer that doesn’t draw anything by itself (layer masks are set to Nothing, but camera culling is set to Everything), so assuming the order of the passes is factored in as well as the event type for execution, this should work, but it gives me this error:

InvalidOperationException: Trying to use a texture (_MainLightShadowmapTexture) that was already released or not yet created. Make sure you declare it for reading in your pass or you don't read it before it's been written to at least once.

This is just using the existing Render Objects feature along with the Blit to RT Handle feature supplied in the demos, with a tiny modification to let me change the blit feature’s render event.
It seems like trying to blit the camera texture at an arbitrary point in the queue is not allowed, or that you’re not allowed to render objects after a blit?

Edit: Switching to compat mode made this actually work… so it seems like it’s to do with RenderGraph preemptively releasing the shadowmap texture that’s needed for the Render Objects pass later in the list