Yeah, I think it has something to do with the doors and frames on either side of my bed.
Wow this is really interesting now. I tried recreating this in a test world and couldn't get it to spawn me anywhere interesting. Which block surrounding the bed do you spawn above?
I did a few more experiments to learn more about the glitch.
I figured out you can do the trick with:
glass, glass panes, tnt, leaves and glowstone.
Neither doors nor item frames seemed to work in any configuration I tried.
I also learned there's a default position where a bed will place you for any bed orientation. If you place one of the blocks I listed above in the default block where the bed would place your feet, and leave an air block above that (or use another of the blocks that work), then above that you can place a column of any block that you can collide with and so long as you never leave 2 air spaces you will always spawn on top of that column when you die.
I might try and make some sort of weird death elevator out of this.