Border in auto layout above neighboring items?

I’m trying to create a component with a selected state like so:

The problem is when the selected item is in the middle, one of the neighboring items will cover the border:

I could change the border from outside to inside, but then there’s a gap between the items and the border. Is there a way to achieve the effect I want in Figma?

Huh, this is interesting. I would imagine implementing some sort of “stack order” – a parallel to z-index in CSS would be possible.