Quote from the preface to The Story of Proof: Logic and the History of Mathematics (2022), by the mathematician John Stillwell:
The history of mathematics can be viewed as a history of proof, because mathematics presents the most extreme challenges to proof.
Motto of the book:
How the concept of proof has enabled the creation of mathematical knowledge.
Mathematics uses deduction (valid logical inference) in/as proofs. Thus it makes no sense to speak of deduction "including or excluding mathematics". Deduction is not some higher category instantiated by math or logic. Deduction is the specific form of argument (which is, among other things, characterized by necessary truth preservation) that is used in standard mathematical proofs. Other forms of proofs are also sometimes used - e.g. purely visual proofs, but those can easily be misleading, so need to be reducible to standard deductive proofs (even though, if not misleading, they can be more beautiful, insightful and instructive than any explicit deduction). There is no special "mathematical form of reasoning" used in deductive proofs. It's just logical, deductive reasoning (either classical or intuitionist). (Which doesn't encompass the reasoning involved in discovery or problem solving, in sofar as reasoning is involved in that, but that's another issue.)
Not all philosophies of logic see logic as "a form of modality". That perspective is mostly due to model theory (going back to Tarski) where "logically valid" is interpreted/explained as "true in all possible models". Gentzen's natural deduction (see proof-theoretic semantics) is not a modal view in this sense, and an approach like dialogic logic is also not. In both these other approaches (philosophies of logic, plus specific ways to develop formal logic(s)) logical validity is based on unambiguous rules and the strict application of those rules.
If the question is what kind of special "mathematical necessity" is somehow inherent in mathematical axioms, then it becomes a lot more interesting. According to a formalist view (going back to e.g. Thomae (1840-1921), vehemently opposed by Frege) mathematics is just a formal game, like chess. The choice of axioms would then be arbitrary. (But, in fact, even for chess the selection of rules - and the content of rules - is far from arbitrary; the variation in rules that is "possible" is pretty radically constrained by, even though it's not fully determined by, what can lead to "interesting", non-trivial games.) From a strictly logical standpoint, the choice of axioms is indeed arbitrary. But the actually selected axioms in mathematics are not arbitrarily selected. The question which axioms are needed, as minimal commitments to make mathematical proofs possible in various branches of mathematics, is taken up by reverse mathematics.
The best way to get a sense of how axioms are actually established is, I believe, to look at rather new, smaller branches of mathematics, such as, for instance, the development of multi-person algorithms for fair cake cutting, or the theory of knots, or the theory of folding (origami). We really never start with any explicit axioms, but with very concrete and basically utterly simple operations. (Such as: take a piece of paper and fold it, once. It seems typical for mathematics that we do almost immediately introduce some idealization. In this case: we image the paper to have no thickness, so any number of folds is "possible". This, I believe, is, the one and only "metaphysical" assumption we're making in this case.) It's only when we start to make general statements or try to relate these activities to other branches, or try to gauge the complexities, that axiomatization may be called for. Reverse mathematics can then also bring out common, underlying, structural similarities with other branches of math.
For an intro to origami, see the Huzita-Hatori axioms. Note how the wikipedia article very deliberately -- and appropriately, I think -- uses the word "discovered" and "rediscovered" in regards to these axioms. It's interesting to reflect on the similarities and dissimilarities with Euclidean geometry. It turns out that the origami operations can, for instance, trisect an angle - which is impossible with compass-and-straightedge.
From the point of view of philosophy of mathematics, the "forgotten" or ignored eighth axiom seems to be the most remarkable: it shows you more generally what we want from "axioms". That axiom states that there is a fold (a fold can be made) along a given line. Why would we need that? It's needed (as axiom/as elementary folding operation) for completeness:
This article reviews the so-called “axioms” of origami (paper folding), which are elementary single-fold operations to achieve incidences between points and lines in a sheet of paper. The geometry of reflections is applied, and exhaustive analysis of all possible incidences reveals a set of eight elementary operations. The set includes the previously known seven “axioms”, plus the operation of folding along a given line. This operation has been ignored in past studies because it does not create a new line. However, completeness of the set and its regular application in practical origami dictate its inclusion.
(Jorge C. Lucero, On the elementary single-fold operations of origami: reflections and incidence constraints on the plane (2017)) (I have rendered in bold what I found philosophically salient. It's an interesting paper, and anyone with either a minimum of knowledge of Euclidean geometry or a minimum of knowledge of paper folding should be able to follow it.)
What we, generally, want from a set of axioms is that each axiom should be as simple as possible; no axiom should be derivable from the set of all the others; all together they should be a sufficient basis enabling proofs of whatever we want to prove. So, simplicity, minimality/independence, and completeness.
The first seven axioms are all 'constructive' (they introduce ways in which a new fold can be constructed); the eighth is more 'foundational': it's needed to ensure that the formal system completely mirrors the practice (all results that can be achieved).
It was only discovered by submitting the initial system (practice plus 7 original axioms) to a rigorous mathematical re-analysis (using a mapping to the geometry of reflections) trying to capture the limits of the whole system. (It's similar to discovering the need for 0 and the identity element in algebra: it doesn't add a "new number" so much as it completes the algebra. The nice thing is that here we can witness the gestation and birth of a 0 in a new branch of mathematics.)