The situation could have been handled better, and under normal circumstances the books would probably have been boxed up by the library staff and put back by them as well as it's not fair to expect a cleaner to have to do that as well, they've got enough to do.
From a librarian's point of view (yes I am one), though, it's not unlike wandering into a supermarket to discover all the tins and jars with red labels, say, and all those with green labels, and and all those with yellow labels had been clumped together rather than by contents.
Not all libraries use Dewey either, specialist libraries like medicine and law have specially designed classifications as Dewey isn't usually specialised enough. And if you're a new nursing assistant, say, popping in before your shift to have a look at information about, I don't know, maybe the underlying anatomy of the respiratory system, or the difference between type 1 and type 2 diabetes, you're probably not going to know the author or have the time to search through thousands of books on the shelves alphabetically. Even with the help off the catalogue. Which, I've observed over the years, most people don't use anyway. And yes you could ask a staff member, if you can find one, although thousands of library jobs have been lost since 2010. When books are organised by subject you stand more chance of finding something relevant.
And anyone who thinks public libraries don't have e-book collections, online magazines, newspaper databases or other resources like geneaology databases these days might be surprised if they took a peek at their local library web pages to see what's on there. Our local service has audio books as well. And I'm normal times they do all kinds of education and community focused sessions. Coding, genealogy, gadget shops, toddler tales...
Oh and in case anyone's wondering, with the exception of 2 larger services I worked for, I always cleaned my own library shelves as the cleaners had enough to do. Though we never had to have a deep clean.