I thought the books were canon
They're treated as such in the sense that other tie-ins are expected to stay consistent with them. But it's always a mistake to think that "canon" means "absolutely inviolable fact that will never be contradicted." Any long-running canon contradicts itself all the time, either by accident or by the deliberate choice to correct earlier mistakes or not let old assumptions get in the way of great new ideas. Since it's fiction, not documentary history, the creators can change it and just pretend it was always the way it is now. The "truth" of canon is whatever it's currently said to be, and earlier canon that's been discarded is presumed to have been erroneous.
There are plenty of examples of this in other franchises, like newer
Star Trek productions ignoring the implicit sexism and other sixties-isms of the original or Marvel Comics pretending that Spider-Man is still in his twenties even though he was in high school in 1962. But it should be self-evident with regard to
Star Wars, considering that Lucas has altered the original canon works, the films themselves, on more than one occasion. The problem is that too many fans are misled by the false belief that the word "canon" somehow implies immutable fact. That's what it's used to (allegedly) mean in religious contexts, but here we're talking about fiction, about works that are overtly not factual and are just exercises in pretending. That includes pretending to be consistent even when they're not, and that's what canon really means.