How to render only objects visible in a chosen view layer?

I don’t mean render pass (render layer), but view layer. Blender always renders all objects, even if they’re disabled from viewport in the current view layer, which makes no sense to me. I found a thread where one explained it:

But it doesn’t work.
I created two cubes, put them in separate collections. Then created one extra view layer. Then I started applying visibility for each view layer, but realized that in outliner I can only assign “hide in viewport” toggle to a view layer. I cannot do it with “disable in renders”, cuz the setting is independent from view layer. I went to View Layer Properties to check “render single layer” and also unchecked “use for rendering” for the other layer, but still all of my objects are rendered. While I only want to render objects that are visible in current view layer.

If view layers are not what I expected, I need another tool for managing objects and collections visibility across renders. It could depend on active camera (but doesn’t have to). I think this addon might be able to do it -
But I kinda expected it to be a native feature.

I am just asking bluntly because you didnt mention it in you text: Did you composit your view layers separately? In the post you are linking he just defines his view layers as render layers in the compositor to render. If this isnt done you wont be able to render them as single images. Just rendering a view layer isnt possible as far as i know, except manually ofc.