Disclaimer: the 'William' books would be my Desert Island book choice, so I am biased!
But
because of the racism and sexism.
Where?
I've read nearly all of the books, if not all. My kids love listening to them being read, unabridged, by the wonderful Martin Jarvis.
Regarding sexism, quite often, the female characters are the stronger, wiser characters who lead the males astray in their pursuit of their own interests. Violet Elizabeth for sure - although in frills & bows, she's really an Outlaw like the others, when she gets into it; she's also absolutely able to manage the Outlaws eg when she decides she wants a new mother or when she 'gets lost' playing with the Outlaws but in fact, is just unrecognisable covered in mud.
Racism, I'm struggling to think?
Certainly there are stereotypical representations that would be unacceptable today eg some Irish characters appear occasionally, usually genial & warm, but workshy & a bit of a chancer.
In terms of class depictions, again, a clear distinction is drawn between William & co, and the lower echelons, including names ('Arry & Bert) but tellingly, William never sees these distinctions or allows them to affect his interactions with others.
Of course, they tell of a world that is alien to us now, woman at home, men at work, household staff in all cases, corporal punishment taken for granted. But it's not inaccurate.
Also, Richmal Compton wrote over a huge time span - 20s to 70s & tho the world moved on - so WW2 is covered, the Beatles get mentioned - William is always 11.
I'd love to know what specifically your wife objects to?
In terms of the wider question, yes, I do think books usually need to be read in the context of their times, with suitable discussion as needed.