If you want $D_2$ to be the set of symmetries of a line segment (a "regular $2$-gon"), then yes, it can be. But you have to take into account that flipping it over (the operation that has order $2$ in any dihedral group) is different from rotating it $180^\circ$ in the plane. So to truly generalize the case of $D_n$ being the group of symmetries of the regular $n$-gon, you have to see it as the set of symmetries of a line segment with an overside and an underside.