AFAIK Switching to/from device view does NOT write to the Library.
That leads me to thinking you have a filtered view.
Always pay attention to the status line. It offers clues as to what (filtering) is going on. and what count will be affected by further actions.
How to read. It varies by what mode (the positions also move).
the words indicate what the numbers represent
The first part is the version of Calibre that is running (stays put

)
### books, is the Library VIEW size
# selected, is how many some later actions will affect <<< important when doing any bulk change.
##### total size is the Library when there is any filter.
If the filter has no matches, the status is 0 of #### total