Building on Cameron Williams' comment:
We want the dot product to have a few nice properties:
- It's a measure of "alignment", as you've written -- how parallel the vectors are.
- It should be commutative. The alignment of $\mathbf{a}$ and $\mathbf{b}$ should be the same as the alignment of $\mathbf{b}$ and $\mathbf{a}$.
- It should be linear, so we can do nice algebra things like $\mathbf{a} \cdot (\mathbf{b}+\mathbf{c}) = \mathbf{a} \cdot \mathbf{b} + \mathbf{a} \cdot \mathbf{c}$.
Now from Condition 1, we want $\mathbf{a}\cdot \mathbf{b}$ to depend on the angle $\theta$ between the vectors. We could just use this angle as the "dot product" but it's kind of unwieldy algebraically. So we take the cosine instead -- it sends angle $0$ (parallel vectors) to $+1$ and angle $\pi$ (anti-parallel, reverse directions) to $-1$. This turns out to be a nice choice.
However, just using $\cos(\theta)$ would not be linear. Let $\theta_{\mathbf{b}}$ be the angle between $\mathbf{a}$ and $\mathbf{b}$, and similarly. for $\theta_{\mathbf{c}}$ and $\theta_{\mathbf{b}+\mathbf{c}}$. By scaling vectors, we can see that $\theta_{\mathbf{b}+\mathbf{c}}$ depends on things other than $\theta_{\mathbf{b}}$ and $\theta_{\mathbf{c}}$. In fact, there is very little relation at all!
Now your idea has using the length of the projection; that is, $|\mathbf{a}|\cos(\theta)$. But this isn't commutative, as Cameron Williams pointed out, because it scales with $\mathbf{a}$ but not $\mathbf{b}$.
So we use $\mathbf{a}\cdot \mathbf{b} = |\mathbf{a}||\mathbf{b}|\cos(\theta)$. This turns out to be a good measure of alignment. It's clearly commutative. Moreover, using the rule $\mathbf{a}\cdot \mathbf{b} = a_1b_1 + a_2b_2 + \cdots + a_nb_n$, it's also easy to compute and satifies the linearity condition.