Why doesn't this proof show that the operation on a factor group is well-defined?
Your question is a common theme that arises whenever we define expressions that depend on non-unique representations of the same thing.
Imagine a similar scenario. Suppose $\text{Units}(x)$ is an operation that picks out the units digit in the decimal expansion of $x$. So for e.g. $\text{Units}(10.01)$ outputs $0$ and $\text{Units}(3.45)$ outputs $3$.
Now certainly $42 = 41.99\bar{9} \cdots$ as real numbers. But $$ \text{Units}(42) = 2 \neq 1 = \text{Units}(41.99\bar{9} \cdots) $$ So substituting equal things into the same expression did not result in the same outcome!
Why did this happen? Because in essence $42 = 41.99\bar{9} \cdots$ as real numbers but they are not equal as decimal expansions. That is, decimal expansions are not unique. The same number can have two different decimal expansions unless we are careful about disallowing a continued series of $9$'s at the end. And unfortunately the operation $\text{Units}(x)$ outputs values based on the non-unique representation of $x$ that we know as decimal expansions.
The exact same issue can happen with an expression like $(aH)(bH)$. Sure $aH$ may equal $cH$ and $bH$ may equal $dH$ as sets. But those sets $aH$ and $cH$ may have potentially different representatives $a$ and $c$. And if the operation $(aH)(bH)$ depends on non-unique representatives, which it does as the operation $(aH)(bH)$ picks out representatives $a, b$ of $aH,bH$ and outputs $(ab)H$, then merely substituting equal things may not result in equal things.
This is why proving the well-defined-ness of the definition $(aH)(bH) := (ab)H$ is necessary. You realize that our definition depends on non-unique representatives $a, b$; therefore you realize that mere substitution will not work. And that is why you get your hands dirty by literally verifying that the definition of $(aH)(bH)$ as $(ab)H$ outputs the same result even when you choose potentially different representatives $cH$ and $dH$ for $aH$ and $bH$ respectively.
Interesting question.
This works if you have previously proved that $aHbH$, thought of as the set of all products of elements one from the each coset, is in fact a coset of $H$. (Once you know that it is clearly the coset of $ab$, since $e\in H$.)
Without knowing that and thinking of $aHbH = abH$ as defining the product to be the coset of $ab$ you are just asserting what you want to prove.
This is an example of "proof by notation", which is where one use symbols to denote concepts in such a way that a claim appears to simply fall out of how objects are represented. A more direct proof by notation for this claim would be "Given $aH$ and $bH$, let $abH$ be the coset generated by $ab$ and $H$. I just defined $abH$, so clearly $abH$ is well-defined". That's clearly fallacious. In your proof, the fallacy isn't as blatant, but it's the same basic principle. You write $aHbH=(cH)(dH)$ = $cHdH$, but what does that even mean? You're relying on implicitly understanding what "two things next to each other means": after years of mathematics classes, you've gotten used to $(a)(b)$ and $ab$ both representing the same thing, namely $a$ multiplied by $b$, but do $(aH)(bH)$ and $aHbH$ both represent "multiplication", and what does "multiplication" even mean? Remember, "$aH$" and $bH$" represent sets. What does it mean to multiply to sets by each other?
The notation $aH$ relies of a basic understanding of cosets and is shorthand for the more complicated notation $\{ah: h\in H\}$. Once you have a solid understanding of cosets, you may be able to easily work with these shorthands, but this question is asking you to prove a basic property of cosets, so using a high-level shorthand is a bit inappropriate. The fallacy should be more clear if we dispense with this shorthand. Instead of writing $aH$, we have $\{ah: h\in H\}$. Instead of $bH$, we have $\{bh: h\in H\}$. And so on. Instead of $aHbH$, we have $\{ah_1bh_2: h_1,h_2 \in H \}$. And instead of $aH=cH,bH=dH$, we have $\exists h_3,h_4 \in H:c=ah_3, d = bh_4$. Now the claim that $aHbH=cHdH$ expands to the claim that $\{ah_1bh_2: h_1,h_2 \in H \} = \{(ah_3)h_1(bh_4)h_2: h_1,h_2 \in H \}$. And that, in turn, is equivalent to $\forall h_1,h_2 \in H, \exists h_1' ,h_2'\in H:ah_1bh_2=(ah_3)h_1'(bh_3)h_2'$.
That is, when you say $aHbH=(cH)(dH)$, you're invoking the entire complicated statement of $\forall h_1,h_2 \in H, \exists h_1' ,h_2'\in H:ah_1bh_2=(ah_3)h_1'(bh_3)h_2'$, and just saying "Well, I've written this claim in a form that makes it look like it's obviously true, so I'm going to just take it as true".
The problem with simply substituting one expression in for another is that $aHbH$ is not defined directly in terms of $aH$ and $bH$. We have $aHbH :=\{ah_1bh_2: h_1,h_2 \in H \}$, so $aHbH$ is defined in terms of $a$ and $b$. So just because $cH=aH$, that doesn't mean that substituting $cH$ in for $aH$ will give the same result: when you replace $a$ with $c$ in the formula $\{ah_1bh_2: h_1,h_2 \in H \}$, you're not guaranteed to get the same answer.
Suppose we had an operation $*$ on fractions that said "the numerator of the result is the sum of the input numerators, and the denominator is the sum of the input denominators". Then $\frac 1 2 = \frac 2 4$, but $\frac 1 2 * \frac 1 3 \neq \frac 2 4 * \frac 1 3$. This shows that $*$ is not well-defined on the rational numbers, because it looks at not the fraction as a whole, but the individual parts of its representation. Similarly, for non-normal subgroups, $aHbH$ is not well-defined, because it is defined not in terms of the cosets as a whole, but rather in terms of the individual parts of its representation ($a$ and $b$). Once you define an operation in terms of the representation of an object, then if the object has more than one presentation, you are no longer guaranteed to have a well-defined operation.