When you respawn, there is a slight delay until you can move again, and I think that is a bug of itself. While you are in the slight delay after respawning, mobs and players can attack you, giving them a few hits until you can fight back.
Steps to reproduce:
spawn a hostile mob near your spawnpoint.
go unto survival, then do /kill.
notice when you respawn, you can be hit even when you are in the slight delay.
I think that delay after respawning might be it's own bug, but I'm not sure.
Related issues
Attachments
Comments



Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response.
By the delay, do you mean that if you respawn while holding a movement key, the game will not register the key until you let go and press it again?
This ticket will automatically reopen when you reply.
Quick Links:
๐ Issue Guidelines โ ๐ฌ Mojang Support โ ๐ Project Summary โ ๐ง Suggestions โ ๐ Minecraft Wiki

no, it just doesn't allow you to move at all, even if you hold or spam a movement key. Also notice in the video for a split second the crosshair is not there, and the text isn't either. This also kind of makes immediate respawn not immediate.

Can confirm in 1.20.51.
Improved reproduction steps:
ย 1. Set your spawnpoint using /spawnpoint @s
ย 2.ย Surround your designated spawnpoint with around 15-20 hostile mobs (preferably zombies).
ย 3.ย Fly a bit away from your spawnpoint before changing your gamemode to survival, then type /kill
ย 4.ย Once you respawn, don't move, let the mobs kill you 2โ3 times in-place so that they properly cluster around your spawnpoint, only then should you start fleeing (which will be very difficult).
Observed results:ย
There will always be a short delay after respawning before the user can perform any actions, whether it be moving, punching, looking around, etc. Additionally, I've noticed that after you click the respawn button (if you have /gamerule doImmediateRespawn set to false), the mouse cursor will linger onscreen for a few ticks immediately after respawn before the crosshair becomes visible.ย
Expected results:
There shouldn't be a delay ofย xย ticks after respawn before a user can perform any action, as this would pose an unfair advantage to hostile mobs if they happen to be near the respawn point, and can land a hit or two on the user before they're able to respond.

One way to fix this bug is to give players a 3 second respawn immunity just like Java Edition.
This was supposed to be fixed in 1.21.0. Is this still an issue?
This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
๐ Bug Tracker Guidelines โ ๐ฌ Community Support โ ๐ง Mojang Support (Technical Issues) โ ๐ง Microsoft Support (Account Issues)
๐ Project Summary โ โ๏ธ Feedback and Suggestions โ ๐ Game Wiki