James of The Action Lab (previously) shows how to perfectly separate each layer of an Oreo cookie and remove the filling intact by using a vacuum chamber. James explains that the lack of oxygen caused the cookies to expand slightly. When the air was let back in, the expanded cookies reduced and separated from the filling center.
So my guess for why this happened is because the inside of the cookie actually expands a little bit. So when you put it under vacuum, the expansion happens slowly, and then when you let the air back in it happens quickly and it unsticks from the cookie on either side. So you get a clean separation of the filling and the cookies.
Here’s the full video explaining the process in more detail.