There are great answers already written, and I'll just add a little more explanation for why this phenomenon exists. In the end, it's a result of the fact that we construct chords from stacked thirds.
How Chords Are Built
Consider a C major chord, which is C-E-G. The interval between the C and E is a third. The interval between the E and G is a third. Sometimes we add other notes beyond the fifth. For example, a CMaj9 chord is C-E-G-B-D. The interval between the G and B is a third, and so is the interval between the B and D.
Minor chords are the same way. Let's consider an A minor chord. You could continue stacking thirds until you've played almost every note in the scale: A3-C4-E4-G4-B4-D5. (McCoy Tyner uses this voicing on John Coltrane's recording of My Favorite Things.)
The takeaway here: chords are built from stacked thirds.
Choosing a Substitution
Let's consider a chord progression like vi-IV-I-V. We can add some variety by changing one of the chords every now and then. Let's choose the IV chord to modify. We achieve the smallest change by replacing the IV chord with a vi chord or a ii chord. In effect, this change entails moving the root note up a third or down a third (respectively). This creates the least amount of change because chords are built from stacked thirds, and hence we preserve much of the original chord. To see this, let's pretend our song is in the key of C major. The IV chord would be FMaj (F-A-C). The two possible substitutions are Dmin (D-F-A) and Amin (A-C-E). Each of these chords shares two common tones with the original FMaj chord:
Given the similarities that Dmin and Amin share with Fmaj, these alternate chords are both capable of serving generally the same function as the Fmaj chord. They introduce some variety into the original chord progression without making any dramatic changes to the harmonic structure.
I've described a broader way to approach the substitutions you've noticed. We could use the description I've given to create new examples beyond the ones you've found. That said, No'am Newton is correct to point to relative minor, because every example you've identified is a substitution between the major and relative minor chords.
In the example I created above, FMaj is arguably closer to Dmin than Amin. The reason is that Dmin7 (D-F-A-C) fully contains an FMaj chord, whereas Amin7 does not. Moreover, Dmin contains the root of FMaj, while Amin does not. So Dmin is
closer to FMaj and thus makes for an even more seamless substitution.