This will not fix your issue and will make PCs too strong
I think you basic assumption is flawed. You state in the comments
I consider characters who don't have the ability to use magic to be at an inherent disadvantage in a world where people have the ability to use magic.
And I can see an argument for this when it comes to out-of-combat capacities, where spellcasters can do lots of insane things at higher levels that mundane characters cannot, like raising the dead, teleporting, scrying from afar, summoning powerful minions to do their bidding, traveling to other planes, and so on.
But from a power level, especially for combat the classes are pretty balanced, maybe with a tendency of later published classes being more powerful.
Sub-Classes commonly seen as the most powerful are always going to be somewhat subjective based on play experiences, but include Twilight or Peace Cleric, Chronurgy or Divination Wizard, Eloquence Bard, Moon Druid, Gloomstalker Ranger, and Echo Knight. Vengeance Paladins also get some mention as do Hexblade Warlocks, but mostly to enhance multiclass builds. (Here‘s another survey, and here my own experiences with a Gloomstalker Ranger outclassing a Divination Wizard).
While there is an overweighting of full casters (bard, cleric, druid, wizard) there are also partial casters (ranger, paladin) or martials (fighter), so it is not that casters are always better. The maybe more important point is that it is overpowered subclass features, not just the ability to cast spells, that push you up there. And these often are pro-active abilities that make these subclasses strong: the ability to double up on healing, to just beat charisma-based tests, to force through save-or-suck spells, to dish out massive amounts of damage.
Blanket enhancing spell immunity to non-casters is not going to fix these imbalances. It will make martial characters a lot more attractive, but guess what: now you get Echo Knights and Gloomstalker Rangers that already were overpowered, even more overpowered.
This is a strong incentive for players to pick martials, but the game is not necessarily designed to be played without casters. Not that it cannot be done, but it is going to be cumbersome. So someone likely still has to play a druid, bard or cleric so the party has a healer, and that player will feel as if they got shafted.
Also, this is different from normal Magic Resistance, that just gives you flat Advantage on the saving throw against magical effects. Here, you gain an increasing degree of immunity as the PC level progresses, up to total immunity for non-casters at 20th level.
And immunity to all magical effects, which this amounts to at higher levels, is pretty unbalancing. The game assumes this does not exist. What happens if a no-save teleport effect hits the party to get them somewhere and now you have a split party, because some made that roll, and others did not?
Lastly, and most importantly, this just makes the PCs stronger, with nothing to offset it. The game is already too easy on higher levels. Our DM routinely confronts our group of 3 high level characters with challenges that have multiples of the XP budget that is "deadly" according to the DMG for a group of 4. This would just make matters worse. The monsters gain no such immunity to the PCs spells.
D&D is designed to have a high level of powerful spellcasting. It is going to be very difficult to change this with a simple mechanical hack and not disbalance the game in some way. This is no fault of yours, it is just hard without a major reworking of the game. Maybe a better solution for you, if you look for something where martials play a leading role, or magic is lower-key would be to pick a different game system, such as Pendragon or Runequest.