Hi Tilo,
At this point, I can't give much specific advice because I don't know enough about what you want. From your message, it seems like you are thinking of pursuing a career as a research mathematician by attending a grad school in math. Even within that, it depends on what area of math you are interested in (e.g., numerical analysis and topology would weight your programming experience/ability differently). It is hard to make general statements about grad school admissions, although anecdotally many in the US will place a large emphasis on test scores (e.g., GRE; if applicable), if there is someone you can work with there, and your letters of rec.
For SageMath, a GSoC project can involve doing research mathematics, which can include using the code written, advancements in order to write code to do computations, or to improve the speed of computations. A part of that is doing the reading to learn the corresponding subject area. You can see this in some of the projects (e.g., improving the combinatorial species project), but you are also free to propose your own. That being said, this is a coding-based program, so producing code will need to be a key component. Yet, depending on the project, it can result in a mathematical publication (which I can mentor such a project, not all of which are listed on the ideas page as they are a bit more math researchy).
For doing an REU, you are going to be working on a research question, which will also include building up your background knowledge. However, there is no guarantee of success or any tangible outputs, the rate depends largely on the subject area. Additionally, nearly all fields in math take over a year (oftentimes more) to publish a paper after submission, so you likely won't get that, but having a preprint on the arXiv will likely give you a major boost over other applicants. This is typically the output of doing an REU.
In short, I would need more information about what you want and what interest you. However, for both of these things, there is no guarantee you will be accepted, so you might consider applying for both. You can always withdraw/decline should the situation change. I am also happy to talk to you over Zoom and/or via direct email if you have any other questions.
Best,
Travis Scrimshaw
PS - Hope you are able to stay dry.