The tail seems like vestigial anatomy (originally useful in fish) that has three possible states in mammals: 1. Repurposed for a new function (tree swinging, signals) 2. Not much used but still in the repo (mice) 3. Garbage collected (apes).
I'm curious about the "garbage collected" theory as there doesn't seem like a lot of selection pressure to remove tails simply due to them not being useful and consuming energy to grow. The appendix is a far more likely candidate for garbage collection as it has no obvious function and can easily cause death if it bursts.
I suspect that there's another reason that apes lost their tails - most likely related to walking on two feet.
Yeah, I suspect a lot more people have experienced diarrhea than appendicitis. If preserving gut bacteria is important enough, then the appendix clearly does have a function.
But it might not be that important at all; do people with an appendectomy struggle more to recover from diarrhea?
Be careful with assuming functionlessness, in general. Evolution does not like spending energy on sticky-out bits that are prone to injury, or good handles for predators to catch, unless they provide some serious advantage.
Presumably as primates got bigger, tails were less useful (not strong enough to be prehensile appendages, and not as handy for balance if you climb methodically instead of carefree leaping).