The button will always be after the space taken by the CollapsingHeader. Space taken is always a rectangle, so the collapsed/hidden part expands it when uncollapsed.
The solution is to put the button in the header of the collapsing widget. Unfortunately CollapsingHeader does not support this as it requires the header to be a string, however you should be able to easily build your own by using CollapsingState, which supports arbitrary widgets for the header.