The secondary barrier would have to be between the cabin and the lavatory, so that the pilot can go to from the cockpit to the lavatory on their side of the barrier. So I imagine that whenever the pilot is not about to or actively using the lavatory that barrier would be left open so that passengers can access it.
Some (all?) U.S. domestic airlines currently have this exact system in place, except with a flight attendant standing guard between the first row of seats and the galley/lavatory/cockpit, starting just before the pilot opens the cockpit door. I have no idea if this has been a regulation thing or just a thing I notice the airlines I fly do, but this physical barrier would probably follow the same usage pattern as the current meat-based barrier.