java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
This is a 2 in 1 issue.
I noticed when I hopped into bed, I started falling out of bed. After testing this in different scenarios it seems to only happen when there's a block 2 above the bed. As soon as I click on the bed to sleep, the sleep cycle starts but the player cycles between falling out of the bed onto the ground and then back into the bed.
Here's a short little video of it happening
In the same type of scenario but I changed the direction of the bed, so the head of the bed has a block 2 above it but the foot of the bed had nothing above it. I noticed when I clicked to enter the bed, it appears the player slides down to the foot of the bed. As if the head of the player is on the foot of the bed, and their legs are hanging off the end of the bed.
I made a short little video to show this happening. Its pretty hard to see it happen because it happens so fast, but I put the blue wool beside the foot of the bed as a marker, so when I hop into bed you can see my feet slide down past the wool
Hopefully this is enough info to explain the issue.