This also relies on a container DIV (".overlay"). So Flexbox doesn't help here.
I'm failing to understand your expectations.
Otherwise, if you don't need the darkening div behind the modal, you can easily create a centered modal with the container being the body tag. Without flexbox. Today.
Again, I don't understand your expectations.