Auto Layout bug

Today during UI class I have discovered an annyoing behavior. I tried to create a simple product card with a picture and a “Special offer” label placed inside the picture.

In order to reproduce the issue:

Step 1: Create a text field, turn it into Auto Layout and give it a fill color, just to create a label basically, like “FLASH SALE” etc…

Step 2: Add a rectangle and fill it with an image.

Step 3: Turn both into an Auto-Layout frame and try to adjust the label and the image so that the label sits inside. While doing so, you shall discover that the image covers the label and hides it, even when the label layer is above the image.

Despite that, when merging a text and an image into Auto-Layout and only then turning the text to Auto-Layout as well to give if a fill color - this method works perfectly fine, but at last both methods shall lead to the same result as far as I am concerned, so there might be a bug here. Or is it?