Do we need both path compression and union by rank together in disjoint set data structure?
No, you are not right, at least not if you want the fastest possible running times.  Using both is faster than using just one of them alone.  Using just Union by rank gives you a $O(m \lg n)$ running time per operation, whereas using both Union by rank and path compression gives you a $O(\alpha(n))$ running time per operation, which is asymptotically faster.  Here $n$ is the number of elements and $m$ is the number of operations performed on them. See https://en.wikipedia.org/wiki/Disjoint-set_data_structure#Time_complexity.