When trying to obtain the layer of an element fails, we try its parent.
fix get_structure_element_layer_id(). Add regression test.