Waking up after you sleep in a bed prioritizes placing you to the side of the bed, even if there are blocks there, rather than the head of the bed without a block in the way. This happens when there is a slab or other non-full block to the side of the bed and an air block to the head of the bed. Rather than prioritizing the empty space, you are placed in a space that has a non-full block occupying it.
The slabs aren't obstructions. If you put normal blocks there, you will indeed wake up at the head