We made this change purposefully, described here:
https://esotericsoftware.com/forum/d/18504-plz-make-drugndrop-in-draw-order-easier/10
It used to be whenever you set the tree filter or cleared it, the selection changed based on what was selected in the viewport (the mesh in your example). That can cause things to become selected or unselected when the filter is turned on or off and that is surprising.
For example, in 3.8.99 filter to show bones, slots, and attachments, select a slot, then filter to hide bones. You lose the slot selection, it changes to the mesh to match the viewport, which may not be what you want.
I'm guessing this is the reason you want the selection to change: you filtered the tree some time ago, now you want to edit the mesh. You select the mesh, but you can't see the tree properties because of the filter. You turn off the filter, and you still can't see the mesh properties because the bone is selected. You have to deselect and select the mesh again, or select it in the tree.
If you change the filter and that makes it so there is no selection, then in 4.2.23 we will make the tree selection match the viewport.
I'm not sure in your example that the mesh should be selected. I'll discuss it with the Spine team and get back to you.