Bed obstruction works mostly fine and prevents the player from spawning for example inside of blocks to suffocate seconds later. My interpretation of this general mechanic is it existing to protect players from themselves and others.
In my screenshot I try to explain issue with that, being that the player cannot spawn ontop of a cactus (presumably because transparent, glass blocks don't count as a safe place either), but on the other side much worse positions (lava sources and flowing lava) to respawn are valid. Thus rendering accounts unusable on servers for example, if not helped, which should not be a requirement to play. As shown in the screenshot and can be extrapolated, it takes only 10 obsidian to trap the player indefinitely in a death-loop.
To be clear: The bug is respawning in lava, this isn't behavior you should expect in any game. (Btw. I tried using the "improvement" tag, it didn't work, but interpreting bad behavior as a bug is fine I guess)
The fix would be as small as an additional "if" and should barely take any nanoseconds to perform. There is no reason not to remove lava from the safe spawning spaces. This removes essentially all low effort trap options.
Knowing better, this somewhat belongs to minecraftsuggestions ("improvement" instead of "bug" was not available), there could be at death a "Reset spawnpoint" button. There could be a following warning to prevent misclicks from having too much of an impact (like with the title screen). This would remove the necessity to implement the fix for this issue and do that arguably better, although both together would make for the best experience.
This is purely to show that it could be solved, that I thought about it and to provide some help with possible solutions. With or without this section, both have their downsides, please don't harass me for choosing the more constructive way.