I think this varies a lot depending on the person and the relationship. When I was younger, I couldn't put up with ribbing at all. I always took it as bullying. I still think very negatively of some of the people I was "friends" with at the time due to that.
On the other hand, I have ~3 friends I made as an adult that I have been talking to very frequently (with some, daily), for a decade or so, and there, any level of ribbing is fine.
I don't think it's about us knowing each other's worst qualities and being fine with it, as a lot of our banter is on things we can't change about ourselves. I think it's just a matter of trust.
On the other hand, I have ~3 friends I made as an adult that I have been talking to very frequently (with some, daily), for a decade or so, and there, any level of ribbing is fine.
I don't think it's about us knowing each other's worst qualities and being fine with it, as a lot of our banter is on things we can't change about ourselves. I think it's just a matter of trust.