You'll notice that the container keeps a fixed width, able to accommodate a single column. Wrapping columns simply overflow it.

Without the ul container expanding to accommodate additional columns, which would in turn expand the parent div, there's no reason to think the extra columns themselves (the li items) would expand the grandparent.

As a solution you can:

switch to flex-direction: row, which has no problem containing wrapping items (demo)