I would think that the building should go to the people who paid for it if there is a split.
That would certainly be the fair and just outcome. But after a recent ruling in Oklahoma, a congregation had to pay $1.75 million to buy back a facility that they had built and paid for. (Kirk of the Hills Presbyterian).
One of the Bishops in Florida was smarter, and thought ahead. He got the congregations to put the property in his name when they bought it. (In most cases, that was long before his office showed its true liberal leanings). He, of course, didn't have any legal problems with kicking out the Christians.