You can ban yourself in singleplayer doing this "/ban @a".
It's really weird and i dont think it should happen.. I provide a video with some proof. Thanks for reading this ! 😃 😃 😃
Related issues
Comments

Oh ok! good to know someone has already reported this! 😃
Thank you for your report!
However, this issue is a Duplicate of MC-121636.
If you have additional information, please add it to that report.
Please search before reporting, as it's likely that one exists already.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki