Let $g(p)$ be the maximal value of $n$ for $x_1\in\{1,\dotsc,p-1\}$, and put $h(p)=g(p)/log(p)$. Here is a plot of $(p,h(p))$ for the first 2000 primes:, together with the functions $13/\log(x)$ and $25/\log(x)$
The six points along the top correspond to the primes 5879, 9743, 10427, 13679, 16673, 16979 with $g(p)=25$. I could not find any other special properties of these primes, and OEIS does not recognise the list. For 20 primes centred at the Mersenne prime 524287, the minimum and maximum values of $h(p)$ are 1.898 and 2.354. In general, there does not seem to be anything special about the Mersenne primes, contrary to what I thought might be the case.