I will work here over a field of characteristic zero, and in fact, to fix ideas, I will be working just over $\mathbb{Q}$ (you can work out what may happen if the characteristic of the field of definition is positive and $>3$... not much changes). I will also only work out here the following case: if a line and an elliptic curve intersect in two points, the line is tangent to the curve.
Let $y=f(x)$ be a function, differentiable at a point $x=a$. Let us define tangent as follows: we say that a line $L: y=g(x)=mx+n$ is tangent to the graph of $f(x)$ at $x=a$, if
$$g(a)=f(a)\quad \text{ and }\quad g'(a)=f'(a).$$
With this definition in mind, let $E/\mathbb{Q}$ be an elliptic curve given by $y^2=x^3+Ax+B$, let $y=f(x)=\sqrt{x^3+Ax+B}$ and let $L: y=g(x)=mx+n$ be a line such that the intersection of $L$ and $E$ intersect exactly at 2 points, $(a_1,b_1)$ and $(a_2,b_2)$. This means that
$$ g(x)^2 - f(x)^2$$
is a polynomial of degree $3$ with only $2$ roots, namely $a_1$ and $a_2$, so one of them is a repeated root. Let us say $a_1$ is repeated, then
$$ g(x)^2 - f(x)^2=(x-a_1)^2(x-a_2).$$
Thus, if we differentiate at a point $x$ we obtain:
$$ 2g(x)g'(x) - 2f(x)f'(x)=(x-a_1)(2(x-a_2)+(x-a_1)). \quad (\diamond)$$
If $b_1\neq 0$, evaluate ($\diamond$) at $x=a_1$. Note that $f(a_1)=g(a_1)=b_1$ by assumption, because $E$ and $L$ intersect at $(a_1,b_1)$. If $b_1\neq 0$, then $g'(a_1)=f'(a_1)$, and therefore $L$ is tangent to the graph of $f(x)$ at $x=a_1$ or, equivalently, $L$ is tangent to $E$ at $(a_1,b_1)$.
Otherwise, if $b_1=0$, then $f(x)$ is not differentiable at $x=a_1$, and in fact either (i) $\lim_{x\to a_1^+} f'(x)=\infty$ and $f(x)$ is not defined on $(a_1,\epsilon)$, or (ii) $\lim_{x\to a_1^-} f'(x)=\infty$ and $f(x)$ is not defined on $(\epsilon,a_1)$, for some $\epsilon>0$. Either way, by taking an appropriate limit in ($\diamond$) we find that $\lim_{x\to a_1} g'(x) = \infty$ which implies that $L$ must be a vertical line $x=a_1$. Since in this case ($b_1=0$) the tangent line to $E$ is also $x=a_1$, we conclude that $L$ is tangent to $E$, as claimed.
Let $f(x,y) = x^3+ax+b - y^2$. Then our equation is $f(x,y) = 0$. At a point $(p,q)$ on this curve, the tangent line is:
$\frac{\partial f}{\partial x}(p,q) (x-p) + \frac{\partial f}{\partial y}(p,q) (y-q) = 0$
Parametrize this with $x(t) = p - t\frac{\partial f}{\partial y}(p,q)$ and $y(t) = q + t\frac{\partial f}{\partial x}(p,q)$.
Then we are to show that $g(t) = f(x(t),y(t))$ has a double root at $t = 0$.
This is a polynomial in $t$, and as you've already noted, $g(0) = 0$. Thus if we show $g'(0) = 0$, then we'll know $g$ has a double root at $t = 0$. This is simply the chain rule:
$g'(0) = \frac{\partial f}{\partial x}(p,q)\frac{\partial x}{\partial t}(0) + \frac{\partial f}{\partial y}(p,q) \frac{\partial y}{\partial t}(0) = -\frac{\partial f}{\partial x}(p,q)\frac{\partial f}{\partial y}(p,q) + \frac{\partial f}{\partial y}(p,q) \frac{\partial f}{\partial x}(p,q) = 0$
I noticed you're a high school student. If this is all a bit too high-level, mimic it in your situation and compute $g'(t)$ explicitly instead of using the chain rule. You could also parametrize with $t = x$ as you have in your question, but this is more general so there's no special case when the tangent line is vertical.
Also, if you're not certain why checking $g(0)$ and $g'(0)$ are enough:
Claim: Given a polynomial $g(t)$, we have that $r$ is a root with multiplicity exactly $k$ if and only if $g^{(j)}(r) = 0$ for $0 \leq j < k$ but $g^{(k)}(r) \neq 0$ (i.e. $g$ and its first $k-1$ derivatives vanish at $r$, but the $k$-th doesn't).
Sketch: Factor $g(t) = (t-r)^k h(t)$, where $h(r) \neq 0$. Then if you write out $g^{(j)}(t)$, all terms have a $(t-r)$ factor in them for $j < k$, but for $j = k$, there's one term without a $(t-r)$ factor, which is exactly $h(t)$, which we know doesn't vanish at $r$.
Thus showing $g(0) = 0$ and $g'(0) = 0$ implies that the multiplicity of $g(t)$ at $t = 0$ is at least two.
Even simpler proof that $g(0) = 0$ and $g'(0) = 0$ implies the multiplicity of $g(t)$ at $t = 0$ is at least two:
Now $g(0)$ is the constant term of $g(t)$. Thus since $g(0) = 0$, the constant term must be zero.
Next, $g'(0)$ is the coefficient of the linear term. Thus since $g'(0) = 0$ then in addition the linear term must be zero.
Thus $g(t)$ has no constant or linear term, so we can factor out a $t^2$. That is $t = 0$ is a double root.
Best Answer
We are working over finite fields, so there is no notion of slope like in curves over the reals (the pictures involve limit processes, which make no sense over a finite (discrete) space). What is happening here, is we are treating the EC like it over $\mathbb{R}$, and deriving a formula for the slope, and from this a formula for $2X$ for a point $X$. Then we interpret this formula in the finite field we are actually working in, because that's our realm of computation. It turns out that this gives the correct doubling formula over finite fields.
So the interpretation was geometrical then turned into pure algebra that works over all suitable fields.