How can we come up with the definition of natural logarithm?
We want a function that changes multiplication into addition. That is, we want $$f(xy) = f(x) + f(y).\tag 1 $$
Substituting $y=1,$ we get $f(x) = f(x) + f(1),$ so we know that $f(1) = 0.$
Now, let's suppose that $f$ is differentiable. After all, we want to find as nice a function as possible. Let's hold $y$ constant for the moment, and differentiating $(1)$ gives $$yf'(xy) = f'(x) \implies \frac{f'(xy)}{f'(x)}=\frac{1}{y}$$
Now it's not hard to guess that $f'(x) = 1/x$ fills the bill, and together with $f(1)=0,$ the fundamental theorem of calculus gives us the definition.
Many calculus texts start with the exponential, and the fact that it is equal to its own derivative, and that it has an inverse function if the codomain is taken to be $(0,\infty)$. By the Inverse Function Theorem, if we write $f(x)=e^x$ and $b=e^a$, $$\tag1 (f^{-1})'(b)=\frac1{f'(a)}=\frac1{e^a}=\frac1b. $$ The inverse function of the exponential is usually named $\ln x$, and by $(1)$ we know that $(\ln x)'=1/x$. We also know that $\ln 1=0$, since $e^0=1$. Then $$\tag2\ln x=\int_1^x(\ln t)'\,dt=\int_1^x\frac1t\,dt. $$ The above shows that the natural logarithm should satisfy $(2)$.
Now, it is not easy to come up with the exponential in a constructive way, in particular at an elementary level. So it is easier to start with $(2)$, and construct the exponential as the inverse of $\ln x$.
At a more advanced level, one can start by defining $e^x$ via the Taylor series and then deducing $(2)$ as above. But that wouldn't cut it in a first calculus course.
I must admit this is a non-obvious approach. The idea of logarithm as presented in high school is very simple and it is just considered another way of rewriting the equation $a^x=b$ as $x=\log_{a} b$. The crucial assumption is that $x$ is a rational number and $a>0,a\neq 1$. But such a presentation does not define the symbol $\log_{a} b$ for all $b$. In contrast the log tables systematically list the values of $\log_{10}b$ for all $b$ with $0<b<10$ which can be distinguished using $4$ decimal digits. Clearly the above presentation is very confusing and entirely unsatisfactory if we want to give meaning to symbol $\log_{a} b$ for all real $b>0$.
However the key takeaway from the above presentation is the fact that $$\log_{a} (xy) =\log_{a} x+\log_{a} y$$ whenever each term on both sides of the equation is rational. This gives us some idea to think about functions $f$ for which the equation $$f(xy) =f(x) +f(y) \tag{1}$$ holds generally and then using some assumptions it is possible to show that $f'(x) =k/x$ for some constant $k$ (see this answer). So the functional equation $(1)$ does give us some hints about the derivative of such a function and we can pretty much define the logarithm as an integral (as in your question) and show easily that the functional equation $(1)$ is satisfied.
Another option is to start with the function $f(x) =a^x$ and define it not just for rational $x$ but also for irrational $x$ using limits. Thus if $\{x_n\} $ is a sequence of rational numbers which converges to $x$ then we can define $a^x=\lim_{n\to\infty} a^{x_n}$. This approach is presented in this blog post. In this approach the logarithm arises not as an inverse function but rather springs up as a limit $$\log a=\lim_{h\to 0}\frac{a^h-1}{h}\tag{2}$$ while trying to figure out the derivative of $f(x) =a^x$. Using the limit definition $(2)$ it is easily proved that $\log$ satisfies the functional equation $(1)$ and that $(\log x) '=1/x$ so that $\log x=\int_{1}^{x}t^{-1}\,dt$.