Could be a coincidence, but that was just before Heisenberg's uncertainty principle (1927) and Godel's incompleteness theorem (1931) dashed the dream of perfect knowledge.
This is unfortunately a widespread interpretation of Wittgenstien's philosophy of mathematics, but it is not a very charitable reading.
Wittgenstein emphasised on numerous occasions (for example directly at the beginning of his lectures on the foundations of mathematics in 1939) that his interest in these proofs was _philosophical_ and that he never intended to criticise any of them _on mathematical grounds_. He explicitly said that his aim was not to interfere with mathematicians, but to investigate the _philosophical conclusions_ drawn by these mathematicians from their proofs.
What exactly Wittgenstein found problematic is hard to describe in a short comment, because much of it depends on Wittgenstein's view of philosophy as a whole, but one example is the platonist bent of Gödel's theorem and his conviction that there are some mathematical "facts" that can never be discovered by mathematical reason. Wittgenstein wants to ask what it means to say that something is "intuitively true", but not provable in any consistent system, but he does not want to object to Gödel's results, merely its "standing".
In Cantor's case Wittgenstein is interested in the concept of the transfinite and of infinities "bigger" than other infinities. He does not object to Cantor's proof at all, but regards the philosophical conclusions drawn from it with suspicion.
(One good example of a philosophical abuse of Gödel's theorem is the argument that computers will never be able to think like humans, because Gödel's theorem demonstrates a limit to what any computer can do as a formal system, but we humans can nevertheless grasp the unprovable statements as intuitively true. This is basically the argument by J. R. Lucas. This is the kind of philosophical nonsense that Wittgenstein wanted to attack and his position on these matters is coincidentally quite similar to Turing's position, who was a student of Wittgenstein's lectures on the foundations of mathematics.)
It certainly did not help that the so-called Remarks on the Foundations of Mathematics are in some parts highly selective constructions by the editors of his posthumous writings.
tl;dr: it's complicated. Wittgenstein never objected to the mathematical results by Gödel and Cantor, but he thought that their results were often blown out of proportion by shoddy philosophical conclusions made on the basis of these perfectly fine mathematical arguments.
I'm not an expert on Wittgenstein, but I think the critique of Cantor's diagonal argument is more to do with its implication that an infinite set can be "bigger" than another. To say so is more of a semantics argument than a mathematical one as it takes for granted the meaning of "infinite". That is, if you define an infinite set as being inherently without size, it makes no sense to then assign it comparitive sizes via cardinality.
I think it has to do with Wittgenstein's constructivism. Since humans can never actually construct an infinite set, one cannot say that such a thing exists as a constructivist. As such, infinity would be a fuzzy without-size concept that Witty was suspicious of. But if one does think mathematical objects are real, then it's not a problem.
I'm guessing constructivists have found better ways to approach infinity than Witty, without conceding that infinity is real.
Wittgenstein was not a constructivist, though. At least in his later years he explicitly argued against any -ism as a position and tried to avoid philosophical theses as a whole. (Whether he succeeded with this undogmatic approach is another question of course, but to say that he was a constructivist would commit him to a position that he did not advocate for, even if many of his remarks can certainly be read in such a way if they are read in isolation.)
I don't get the sense that Wittenstein was suspicious of infinity as an idea / concept in itself, only of its treatment in mathematical logic. Otherwise much of his writings on it could've been far more terse.
These are excerpts, some paragraphs are missing, but the gist is more or less there and you can find the full discussion in 'Remarks on the Foundations of Mathematics'.
Even the Remarks on the Foundations of Mathematics are only a selection of some of Wittgenstein's notebooks made by the editors of his posthumous publications. It is not a work by Wittgenstein in the same sense as the Tractatus or the Philosophical Investigations.
The Part II of the Remarks on the Foundations of Mathematics, which is the part on Cantor, is especially questionable. It is compiled from two documents of Wittgenstein's Nachlass, Ms-117 and Ms-121, but only about a third of the remarks in Ms-121 were included in the published book. There are also other notebooks were Wittgenstein discussed Cantor (most notably Ms-162a and Ms-126b) and which were not published at all. The editors made the decision to exclude some of these remarks because Wittgenstein's notebooks often contain merely drafts of remarks that were never fully developed, so it would be wrong to say that the published book is a deliberate misrepresentation of Wittgenstein's thoughts, but the situation is definitely quite nuanced and complex.
I personally think that the Remarks on the Foundations of Mathematics are very interesting, but that it's a disservice to Wittgenstein and any reader of his works to read his remarks on the philosophy of mathematics as a disconnected collection of aphorisms. The context really matters and his more mathematical remarks only make sense against the backdrop of the Philosophical Investigations and perhaps even his later writings such as On Certainty.
Unless he published a formal demonstration of Gödel's 'error', Wittengenstein's belief is of mere biographical interest. History is littered with eminent people who had all sorts of erroneous beliefs about theories and ideas that we now see as having withstood the test of time.
Wittgenstein never held the view that Gödel's theorem was wrong or erroneous, though. He "only" thought that the philosophical interpretations and the view of the theorem as astounding and incredibly deep were misleading.
Also world events. WWI, The Great Depression, WWII, the Holocaust, the Atomic Bomb, and then the following Cold War where everyone lived in fear of nuclear annihilation dashed the dream the human intellect would inevitably lead to a utopia.
And that period up to at least the 70s was highly productive in fields such as cybernetics and organisational psychology.
Some of that way ahead of its time culturally, and some genius-level deep thinking behind it. The best of that work (Stafford Beer’s Viable System Model stands out for me) seems to represent some kind of golden age, work that would be hard to do today I suspect.