Recently graduated math student here. The definition of the "vec" operator which turns a matrix into a vector works like this, stacking up columns rather than rows.
Vectors are traditionally written as columns, so just writing all the columns in left-to-right order into a bigger column makes sense. The confusing bit isn't the ordering of the elements in a matrix, it's that someone decided to write vectors as columns to begin with!
It took me long while to stop being afraid when people wrote vec^T where ^T means transposed. I was like "but why can we do that", and the mathematician answered - "well, because it is just more convenient this time". o_O
The plus side is that you can use row vectors with matrices acting from the right, and keep the traditional matrix multiplication. Rare case of two wrongs creating a right.
https://en.wikipedia.org/wiki/Vectorization_(mathematics)