Forgive my ignorance but can mathematical proofs be refactored the same way computer programs can?
I am 100% sure that yes, it's just not mainstream yet. (Why? Because lean proofs are computer programs)
----------------
The big caveat: This is only if the proof is formulated as a computer program, which is the case here with the Riemann Hypothesis proof. (Lean is a general programming language; and every "proof formalized in Lean" is also a Lean computer program.)
Much of mathematics is not yet formualated in such way (although much progress was made by countless contributions of researchers and amateurs in the last years, both in Lean but also in other proof assistants. Lean seems to become the de facto standard though, but I am watching from the sidelines, so take that with a pinch of salt please)
I explained this connection between computer programs and proofs further in this comment: https://news.ycombinator.com/item?id=50589618#50594374
Yes, absolutely. You might take part of your big proof and extract it out in a named lemma. Then you might find that if you strengthen this lemma a bit, you can suddenly use it a multiple places in your main proof (the analogy here to programming and extracting things into generalised functions should be obvious). But you might also take whole subparts of your proof and prove it in a different ways, but as long as the assumptions and conclusions (input / output) stays compatible, it does not need to change much in the main proof.