"A patent for a claimed invention may not be obtained [...] if the differences between the claimed invention and the prior art are such that the claimed invention as a whole would have been obvious before the effective filing date of the claimed invention to a person having ordinary skill in the art to which the claimed invention pertains."
Oh, I agree with you. It's just not how the patent industry actually works.
I'm not entirely sure why, but there appear to be perverse or at least badly aligned incentives for patent examiners, and it would appear they only look for prior art in specific locations, and these aren't the ones that the industry uses.
So you get situations like someone getting a patent for putting structures on multiple lists at a time (e.g., a lookup list, and an LRU replacement list, and maybe a list for keeping track of locks) and this is something that people have been doing since rocks were young, but some nincompoop at OraGooSoftBook got a patent on it because these structures appear in OS textbooks or maybe Knuth and not anything the examiner encountered in law school, or any legal publications. And now FaceGooSoft has a legal lock on code you wrote (hey, you did diligently read all the patents relevant to your industry before you wrote a single line, just like everybody else does right?).
https://www.law.cornell.edu/uscode/text/35/103