OK, that makes sense. I had not read _set_activations in detail at that point.
But now, I'm not sure why you would always want to forbid initialization of consecutive layers. In the same example, with 4 layers, I could imagine wanting to set layers 0, 2 and 3. The code would set 0 and 2 to the provided values, then attempt to calculate layers 1 and 3 from the values at layers 0 and 2. Your code then ensures that 3 is set to the provided value, but 1 would still be computed from 0 and 2.
The only case we have to detect and prevent is when a provided value gets completely ignored, because all layers depending on it are also provided. For instance, providing 1 and 0 (0 gets ignored), or 1, 2 and 3 (out of 4 layers, as 2 would be ignored).