Your pineapple upside down cake might have fallen apart for a few reasons. The most common reasons are overmixing the batter, not adequately greasing the baking pan, and hitting or banging the pan to release the cake. To prevent these issues, grease the cake pan well, and gently turn the cake upside down to release the cake. If you are making a gluten-free upside down cake, you do not need to worry about the cake texture being adversely affected by overmixing. Instead, I recommend giving it a few extra good stirs. Additionally, let the gluten-free cake batter rest for 30 minutes before pouring it into the cake pan, as this hydrates the flour, helping the cake's texture and consistency.