When enabling rendering layers in deferred, it seems the values are not written into the Gbuffer. If you add the Decal Renderer Feature then go into playmode, the rendering layers will start to work, I assume due to the Decal feature requesting Rendering Layers?
On a side note while looking at this bug, it also seems that just adding decals will make rendering layers work even though rendering layers are not enabled on the decal feature, not sure if there is a more severe underlying issue here with decals also.
(new repro steps are in the Comments)
Repo Steps:
1. open attached project
2. load the SampleScene
3. both cubes are black
4. find the Settings/URP-HighFidelity-Renderer.asset
5. enabled the Decal feature
expected results: nothing should change as one of the cubes should be lit already
actual results: suddenly one of the cubes are lit and the other remains black due to rendering layers working.
Earliest repo:2022.3.5f1, not sure if it is a regression as I didn't test that far back, also repos in 2023.2.0a20
Feel free to reach out to me AndreM if you have any issues reproducing this bug.