How to properly hide the div of an inline collapsible button?

To solve the problem we have to use the adjacent selector + and shortcodes.

With the adjacent selector we target any .con after a p, any p after a .con. and any br after a div.

p + .con { margin-top: -1em; }
.con + p { margin-top: 0; }
div + br { display: none; }

Then we define a shortcode for each <div class=con>...</div>. If the content of each div is a shortcode we can do the job with a loop

$shortcodes = array('...','...',...);
foreach ($shortcodes as $name) {
    add_shortcode( $name, function ( $atts ) use ( $name ) {
        remove_filter( 'the_content', 'wpautop' );
        $content = apply_filters( 'the_content', '<div class=con>[block name=" . $name . "]</div>' );
        add_filter( 'the_content', 'wpautop' );
        return $content;
    });
}

otherwise we use the usual way

function scname_sc( $atts ) {
    remove_filter( 'the_content', 'wpautop' );
    $content = apply_filters( 'the_content', '<div class=con>...</div>' );
    add_filter( 'the_content', 'wpautop' );
    return $content;
}
add_shortcode( 'scname', 'scname_sc' );

Finally we can obtain the desired output by writing

text
text <button class="col">btn1</button> text <button class="col">btn2</button> text
[...][...]
text

text <button class="col">btn3</button> text <button class="col">btn4</button> text
[...][...]

text
text <button class="col">btn5</button> text <button class="col">btn6</button> text
[...][...]
<ul>
     <li>text</li>
     <li>text</li>
</ul>
text
<ul>
    <li>text</li>
    <li>text <button class="col">btn7</button> text <button class="col">btn8</button> text
        [...][...]</li>
    <li>text</li>
    <li>text <button class="col">btn9</button> text <button class="col">btn10</button> text
        [...][...]
        text <button class="col">btn11</button> text <button class="col">btn12</button> text
        [...][...]
        text <button class="col">btn13</button> text <button class="col">btn14</button> text
        [...][...]</li>
    <li>text</li>
</ul>
text

error code: 523