is short for
which in turn would be short for
horzcat(1, 2, horzcat(3, 4), 5)
and there is no problem doing concatenation between a vector and a vector giving a longer vector result.
Consider that you could also have tried
This is valid in MATLAB as long as the number of rows generated by the part to the left of the A in [1 2 A 5] is the same as the number of rows in A, and the number of rows after [1 2 A] is the same as the number of rows in 
MATLAB [A B] syntax does not mean to set individual elements with individual scalars A and B: it means to drop in the contents of A and B and concatenate them together on the second dimension (by default), or on the first dimension if you use ; as the delimiter like [1 2;3 4] is vertcat(horzcat(1,2), horzcat(3,4))
How come I can do element-wise multiplication but not addition?
Addition and subtraction and logical and (&) and logical or (|) and relationship operators < and > and == and <= and >= and ~= are always element-by-element already and do not need a special element-by-element form.