@Pl45m4 I want to close this out for future devs looking for the right answer.
The above solution is run before dockwidget->hide() and deleteLater().
We aren't ever undocking the dockwidget here. As far as I understand, my solution sends an event to the QMainWindow telling it the left mouse button was released, and the mainwindow responds accordingly, in this case, it ends the resizing of the dockwidget. The reason we send the event to the qmainwindow is that it is in charge of the dockwidget separators; I figured this out from some inspection of the source code and searching online.
Also notably, the pointer to our parent qmainwindow is guaranteed safe in my implementation. The code that closes the dockwidget is running in the scope of the qmainwindow and we are just using 'this'. It might be dangerous to use this code within the scope of the qdockwidget and get the pointer to the parent with parent().