There are lots of other practical and possible shapes, whether in the form of squares, far narrower/longer rectangles, or tapering triangular pennants. How did the modern standard come about, and how in the world did someone apparently get every nation in the world to abide by it?
Not every nation. The Swiss and Vatican City flags are square. Nepal's flag is a jagged double pennant.
There was a large thread on this earlier this year:
hi! you might be interested in responses to these similar questions
and, may want to x-post this question to the flag sub, /r/vexillology