Counting inversion pairs - $n^2$ results in $n \log n$ time?
Here is an even more amazing example. The determinant of an $n\times n$ matrix is a sum of $n!$ products, yet we can compute it in time $O(n^{2.373})$. 
Here is another striking example. Given a binary string of length $n$, we can count the number of binary strings of the same length in time $O(n)$ even though there are $2^n$ of them.
What limits the running time is not the magnitude of the output but its length.

In this particular case, the output length is $O(\log n)$, so it provides no meaningful limit at all. Even though there could be up to $\binom{n}{2}$ many inversions, we can count them without listing them all, just as in the example of binary strings. As you mention, there is an $O(n\log n)$ algorithm doing that. It is conceivable that there is an even faster algorithm, though nothing faster than $O(n)$, since you need (in general) to read at least $n-1$ entries of the permutation before you can be sure what the number of inversions is.