I don't have visual info about this bug but it just happened to me and it's so annoying. I had made a raid in my base and I couldn't find the last mob so I left it alive. I went in my house to sleep but I had monsters nearby. So I opened the door and a creeper exploded. I went to the storage to get the blocks and fix the damage but in the storage there was a zombie it moved one block and then stopped but I continuing receiving damage from it and it's still body did the attack animation. After a little bit I died from the invisible zombie but when I killed the still body it was gone then the same hapenned with a spider and then again with a zombie. Pls Mojang if you're seeing this fix it because it was annoying losing all of my levels and I'm sure that long level players are gonna be furious.
invisible mobs? this is a well know optifine bug soooo are you playing with optifine installed?
Also nobody would judge you wrong if you obtain the levels again with commands beacause it was a bug.