Question about path loss exponent estimation from measurment
The path loss exponent does not depend on the reference distance. There are two mistakes in your path loss formula. First, path loss does not include the gains of transmit or receive antennas. Second, the path loss exponent must also be part of the expression for the path loss at the reference distance.

According to the Friis transmission equation  the ratio between the received power $P_r$ and the transmitted power $P_t$ is given by

$$\frac{P_r}{P_t}=G_tG_r\left(\frac{\lambda}{4\pi d}\right)^2\tag{1}$$

where $G_t$ and $G_r$ are the gains of the transmitter and receiver antennas, respectively, $\lambda$ is the wavelength, and $d$ is the distance between the transmit and receive antennas. The squared term in parentheses (or its inverse) is the free-space path loss. Note that it does not include the antenna gains. In order to account for other environments than free-space, a path loss exponent $n$ is introduced:

$$\frac{P_r}{P_t}=G_tG_r\left(\frac{\lambda}{4\pi}\right)^2\frac{1}{d^n}\tag{2}$$

In free space we have $n=2$; in lossy environments, $n$ can be greater than $2$.

If we introduce a reference distance $d_0$, Eq. $(2)$ becomes

$$\frac{P_r}{P_t}=G_tG_r\left(\frac{\lambda}{4\pi}\right)^2\frac{1}{d_0^n}\left(\frac{d_0}{d}\right)^n\tag{3}$$

In dB we get

$$\begin{align}10\log_{10}\left(\frac{P_r}{P_t}\right)&amp;=10\log_{10}(G_t)+10\log_{10}(G_r)+\ldots\\&amp;\ldots +20\log_{10}\left(\frac{\lambda}{4\pi}\right)-10n\log_{10}(d_0)-10n\log_{10}\left(\frac{d}{d_0}\right)\end{align}\tag{4}$$

where

$$PL_0=20\log_{10}\left(\frac{\lambda}{4\pi}\right)-10n\log_{10}(d_0)\tag{5}$$

is the path loss at the reference distance $d_0$. Note that in $(4)$ the reference distance $d_0$ will cancel out, so the estimate of the path loss exponent $n$ will not depend on $d_0$. On the other hand, the estimate of $n$ will have a (weak) dependence on the antenna gains. This is however not in conflict with the fact that the path loss as a function of distance is a straight line on a log-log plot.

Note that in practice, the path loss at reference distance $d_0$ is often just set to the free-space path loss, i.e using $n=2$ in Eq. $(5)$ $[1]$. In that case the reference distance $d_0$ will no longer cancel out in $(4)$ and the estimate of the path loss exponent $n$ will depend on the choice of $d_0$. Alternatively, $PL_0$ can also be measured at distance $d_0$, or its can be optimized together with $n$ to obtain an optimal fit to measured data $[1]$.

[1] Wireless Communications, A. Goldsmith, 2005 Cambridge University Press, p. 41.