He gambled that the Democrats wouldn't vote to remove him even though he did everything they asked him to do. They don't care anyway. The election is coming up and even if Donald Trump becomes the Speaker for the next year, it's still worth the price to pay by having McCarthy removed. The Democrats are happy to point out that the Republicans are incapable of governing.
But I think this is a feature by our Founding Fathers. Gridlock is good so nothing get done.
Democrats do not want the Republicans and they do not need the Republicans any longer to keep up the pretense of "Our Democracy"(tm). For that matter, the show is in its' last season. It is about to be cancelled and replaced by a new "reality" show. I hear it is provisionally called "World War 3".
Republicans are too stupid to notice the change. They still believe they can keep their phony baloney jobs.
The "rules" are shifting underneath all our feet.