The OPs question is whether "a realist mindset" is required to grasp some forms of knowledge. I take it that this also includes: Is a realist mindset necessary for -- or at least more conducive to -- making particular new discoveries?
I do not have an answer to the OPs question, but the very same question (or cluster of questions) is addressed by Hao Wang in his book From Mathematics to Philosophy (1974).
TL;DR Wang presents Kurt Gödel's answer, which is that a realist (objectivist, platonist) mindset was indeed necessary as general mental attitude and "philosophical view" for his major discoveries.
The importance of this answer, I think, is that it (1) comes from an authoritative source, someone who did indeed make some amazing, important discoveries in logic and metamathematic, and (2) that is indicates very specific reasons why Gödel thought this "attitude" was required. This is a vivid, concrete illustration of what @Conifold referred to (in one of the comments above) as ".. but interpretations may affect creative, connotational and motivational aspects" - but it is a stronger statement I believe. (But note the emotive colors in Gödels reply: "blindess", "prejudice", "preposterous" other views.)
Hao Wang's book is an introduction to the philosophy of mathematics and a self-criticism of academic analytic philosophy, in particular (but not exclusively) of logical positivism and linguistic philosophy (Wittgenstein and his epigones). Wang's purpose is to try to make philosophical research and debate more serious and relevant (for actual work in math and logic, for science and society in general). "Serious" implies more careful in its expositions, explanations and interpretations; it implies not trivializing or dismissing out of hand gross facts of human knowledge and experience (including introspective experience).
Wang was a personal friend of Gödel and he quotes from a letter that Gödel sent him, precisely about this question. Since the book may be relatively unaccessible to many, I will just quote most of the passage (found in the introduction section "Against Positivism", page 8-9). I'll use "(...)" to indicate parts that I left out. Brackets like "〔...〕" indicate an insertion that I added. Italics are from the original text. (Note that the double-quote margin indicates Gödel's letter as quoted by Wang.)
We do have the striking example of Gödel who possesses firmly held philosophical views which played an essential role in making his fundamental new scientific discoveries, and who is well aware of the importance of his philosophical views for his scientific work. A paper of Skolem in 1922 contains the mathematical core of the proof of the completeness of pure logic. In commenting on the puzzling fact that Skolem failed to draw the interesting conclusion of completeness from his work, Gödel wrote the following paragraphs about the role which his philosophical views played in his work in mathematical logic:
The completeness theorem, mathematically, is indeed an almost trivial consequence of Skolem 1922. However, the fact is that, at that time, nobody (including Skolem himself) drew this conclusion (neither from Skolem 1922 nor, as did I, from similar considerations on his own).
(...) when in his 1928 paper (...) he 〔Skolem〕stated a completeness theorem (about refutation), he did not use his lemma of 1922 for the proof. Rather he gave an entirely inconclusive argument. (...)
This blindness (or prejudice, or whatever you may call it) of logicians is indeed surprising. But I think the explanation is not hard to find. It lies in a widespread lack, at that time, of the required epistemological attitude toward metamathematics and toward non-finitary reasoning.
Non-finitary reasoning in mathematics was widely considered to be meaningful only to the extent to which it can be 'interpreted' or 'justified' in terms of finitary metamathematics. (Note that this, for the most part, has turned out to be impossible in consequence of my results and consequent work.) This view, almost unavoidably, leads to an exclusion of non-finitary reasoning from metamathematics. For, such reasoning, in order to be permissible, would require a finitary metamathematics. But this seems to be a confusing and unnnecessary duplication. Moreover, admitting 'meaningless' transfinite elements into metamathematics is inconsistent with the very idea of this science prevalent at the time. For according to this idea metamathematics is the meaningful part of mathematics, through which the mathematical symbols (meaningless in themselves) acquire some substitute of meaning, namely rules of use. Of course, the essence of this viewpoint is a rejection of all kinds of abstract or infinite objects, of which the prima facie meanings of mathematical symbols are instances. I.e. meaning is attributed solely to propositions which speak of concrete and finite objects, such as combinations of symbols.
But now the aforementioned easy inference from Skolem 1922 is definitely non-finitary, and so is any other completeness proof of the predicate calculus. Therefore these things escaped notice or were disregarded.
I may add that my objectivistic conception of mathematics and metamathematics in general, and of transfinite reasoning in particular, was fundamental also to my other work in logic.
How indeed could one think of expressing metamathematics in the mathematical systems themselves, if the latter are considered to consist of meaningless symbols which acquire some substitute of meaning only through metamathematics?
Or how could one give a consistency proof for the continuum hypothesis by means of a transfinite model △ if consistency proofs have to be finitary? (Not to mention that from the finitary point of view an interpretation of set theory in terms of △ seems preposterous from the beginning, because it is an 'interpretation' in terms of something which itself has no meaning.) The fact that such an interpretation (...) yields a finitary relative consistency proof apparently escaped notice.
Finally it should be noted that the heuristic principle of my construction of undecidable number theoretical propositions in the formal systems of mathematics is the highly transfinite concept of 'objective mathematical truth', as opposed to that of 'demonstrability' (...), with which it was generally confused before my own and Tarski's work. Again the use of this transfinite concept eventually leads to finitarily provable results, e.g. general theorems about the existence of undecidable propositions in consistent formal systems.
In a later letter Gödel adds a bit of a caveat (I'll only give a partial quote):
Of course, the formalistic point of view did not make impossible consistency proofs by means of transfinite models. It only made them much harder to discover, because they are somehow not congenial to this attitude of mind. However, as far as the continuum hypothesis is concerned, there was a special obstacle which really made it practically impossible for constructivists to discover my consistency proof. It is the fact that the ramified hierarchy, which had been invented expressly for constructivist purposes, has to be used in an entirely nonconstructive way.
Wang mentions some of his more detailed follow-up questions and Gödel's responses and summarizes those as
Gödel observes that it is possible to get, without his objectivism, different proofs of his incompleteness results, by using, for example, the analysis of formal systems in terms of Turing machines. But the proofs are much harder to discover.
Wang then also discusses in more depth the continuum hypothesis where Gödel attributes Hilbert's failure to attain a definite result earlier to a "philosophical error", i.e. not his reluctance in using nonconstructive mathematical proofs (which was a mere reluctance, not a total rejection), but the belief that nonconstructive metamathematics is of no use.
Wang finally also points at an apparent, well-known counter-example where "the positivist position ... turned out to be fruitful" - which is Einstein's clarification of the concept of 'simultaneity'.
The rough idea is that asking the operational meaning of simultaneity is a crucial step in the discovery of the special theory.
Einstein himself pointed out the importance to him of the writings of Hume and Ernst Mach.
Gödel points out that the fruitfulness of the positivistic point of view in this case is due to a very exceptional circumstance, namely the fact that the basic concept to be clarified, i.e. simultaneity, is directly observable, while general basic entities (such as elementary particles, the forces between them, etc.) are not. Hence the positivistic requirement that everything has to be reduced to observations is justified in this case. That, generally speaking, positivism is not fruitful even in physics seems to follow from the fact that, since it has been more or less adopted in quantum physics (i.e. about 40 years ago) no substantial progress has been achieved in the the basic laws of physics, even though the present 'two-level' theory (with its 'quantization' of a 'classical system', and its divergent series) is admittedly very unsatisfactory. Perhaps, what ought to be done is to separate the subjective and objective elements in Schrödinger's wave function, which so far has by no means been proved impossible. But exactly this question is 'meaningless' from the positivistic point of view.
As I said at the outset, I don't have an answer to the OPs general question and don't know what to think of these very strongly presented views of an eminent mathematician. As direct self-reflective observations about Gödel's own experiences and his process of discovery, of course, we can only accept this. But I also believe there is an undeniable vagueness at the core:
... somehow not congenial to this attitude of mind ...
I also wonder: For other important concepts - for instance the concept of a turing machine - wasn't a firmly anti-realist view required? Was it not Turing's "concretist", engineering-like mindset (which is not quite the same as a "formalist" one but still seems very "anti-realist") that enabled him to come up with this? Further, it seems to me that the strong "objectivity" in math, the amazing agreement and certainty about mathematical results, crucially depends on notation. We externalize "concepts" so they become the little lego blocks we can play with (and which can then be glommed together in new blocks). Is it perhaps the notation (the way we use that) that then makes it appear as if we're dealing with a totally different realm of existence, a realm that exists independent of our constructions?