I like this idea a lot!
I'd probably make the DC a straight 10 + spell level, though; no need to overcomplicate things.
If you allow it, I think you should limit use of non-class spells to those with the Magic Initiate and Ritual Caster feats, and then only those with the correct class.
Doesn't this reduce the impact of the Rogue: Thief 13th level of ability "Use Magic Device?