A problem with the greedy approach to finding a maximal matching
You're correct, you're not missing anything -- except that the algorithm is not wrong.  The task is to choose a maximal matching, not a maximum matching.  There may be many possible maximal matchings, many of which are not maximum matchings.  It's the difference between a local optimum vs a global optimum.