If the keepInventory gamerule is true, a player dies and while they're dead the gamerule is changed to false, the player will respawn with an empty inventory. The items won't be where they died either.
Video demonstration (Look at the hotbar at the start and end): https://youtu.be/m4TKw1TQsQ8
I'd say this is working as intended since death and respawn do not have to happen immediately after another but still need to follow the current gamerules.