Good point! We have $\frac{dx}{dt}=kx$. Thus $x$ is a function of $t$. Crossing our fingers about possible division by $0$, we have $\frac{1}{x}\frac{dx}{dt}=k.\tag{$1$}$ Now let $F(x)$ be any antiderivative of $\frac{1}{x}$ with respect to $x$. Then by the Chain Rule, the left-hand side of $(1)$ is the derivative of $F(x)$ with respect to $t$. So we have $\frac{d}{dt}(F(x))=k,$ and therefore $F(x)=kt+C.$ In our case, $\log(|x|)$ is an antiderivative of $\frac{1}{x}$ with respect to $x$, and we get the general solution of the DE.
Note that the mysterious process in which we separate $\frac{dx}{dt}$, which is not a ratio, into $2$ parts, "$dx$" and "$dt$," gives us exactly the same final answer. We can think of it as a symbolic manipulation that gets us to the right answer.
Remarks: $1.$ Note that $x=0$ is a solution of the DE. If we use $\log(|x|)=kt+C$, then $x=\pm e^C e^{kt}$, and $e^C$ can never be $0$. However, it is traditional to replace the constant $\pm e^C$ by a new constant $D$, so we get $x=De^{kt}$. The case $D=0$ covers the solution $x=0$ that we had lost by dividing. A nice case of two mistakes cancelling.
$2.$ At a (much) later stage, the "differentials" that we used can be given precise meaning.