The forging divinity novel series is set up similar to this in which people are often able to master one type of magic such as fire, metal, of protection with dedicated sorcerers able to tap into more than one type of magic. I think it could work quite well in D&D but it might take some work to split the lists into different types of magic (or do it on an adhoc basis as you need the spells) and you may want to rewrite some of the subclasses to better make it work.
I'd use magic initiate as the basis, allowing a player to tap into a single path of magic. If they chose fire spells and then later picked up a spellcasting class, then you could either require that their first spells be fire, expanding on their theme or allow them to expand into a second theme.
For more dedicated casters, allow for 2 or more paths depending on the type of caster. An Eldritch Knight might start out being able to work only a single path of magic then gain a second at a later level. Whether you would want to limit the types of paths that eldritch knights, arcane tricksters, paladins, wizards, etc get would be up to you, but you might want to allow casters to learn any theme. If you do though, it might be better to use a single class as the base for caster classes or it could just be separate traditions for learning magic (clerics may be a more battle ready way of learning magic whereas wizards may be the more scholarly way of learning to use magic).
You could also link themes together. So a caster that is able to use lightning spells might be able to later learn spells dealing with thunder or wind. A caster with fire might later be able to link to spells that deal with light. Earth could link to acid and metal, etc.
I think it would be quite a lot of work for the initial set up, but it could be a fun way to play. Make sure that your players are ready to play with these restrictions first though as you may not want to do a lot of the work and then have it pushed back by player's lack of interest... or you might want to since creating stuff like this can be fun.