Staff members are protected and an error is displayed as expected. The issue is with normal users which are able to give a ban to themselves. I just think this is not the expected behavior so thought to report and be sure.
It's not explicitly intended, but it's certainly not inherently invalid, such as following/ignoring yourself or creating a conversation with only you as a participant. Those are cases where we prevent an action to avoid problems.
Here, the action is perfectly valid; it is just borderline if it makes sense. Arguably it doesn't. However, we've had the ability to report your own content reported as a bug; there are times when things may not have an immediately obvious use to someone, but others may find value in it.
Admittedly, here it's a stretch; at best, it's probably mostly for testing. But is there an actual advantage to preventing it?
Probably no real advantage as for how it works now.
Personally I was working to extend the reply ban option, and count how many reply bans each member got.
The fact that users can reply-ban themselves (out of curiosity for example) could lead to invalid results. So this is how I found this issue.
Obviously I can add that check myself, just wanted to be sure if this shouldn't be changed in the core as well.