It is something of a myth that everything has already been studied and that you have to master thousands of pages of prior work before you can contribute something new.
To be sure, there are some subfields of mathematics that are highly technical, and you're unlikely to be able to contribute something new to them unless you've studied a lot of background material. However, there are also areas of mathematics that don't require that much background knowledge. For example, Aubrey de Grey recently made spectacular progress on a longstanding open problem in combinatorics, and almost no background knowledge was needed for that problem. Even in supposedly highly technical areas of mathematics, people sometimes come up with breakthroughs that employ very little advanced machinery.
As others have mentioned, more crucial than "knowing everything" are (1) finding a good problem to work on, and (2) having problem-solving ability. If you have both of these, then you can typically learn what you need as you go along. When you're at an early stage in your career, finding a good problem generally requires an advisor, unless you have the rare ability to smell out good problems yourself just by reading the literature and listening to talks. Problem-solving ability is probably innate to some extent, but a lot of it comes down to experience and persistence. Of course you will be a more powerful problem solver if you have a lot of tools in your toolbox, but generally speaking, you get better at solving problems by spending your time directly attempting to solve problems, and only reading the 500-page books when it becomes clear that they are needed to solve the problem you have in mind.