Your question: Are these [Wish or Divine Intervention] valid ways of regaining the ability to cast wish?
Wish (PHB p.288)
You might be able to achieve something beyond the scope of the above examples. State your wish to the DM as precisely as possible. The DM has great latitude in ruling what occurs in such an instance; the greater the wish, the greater the likelihood that something goes wrong. This spell might simply fail, the effect you desire might only be partly achieved, or you might suffer some unforeseen consequence as a result of how you worded the wish
It the DM's decision what occurs if you should decide to try this. The DM does not have to tell you anything about the actual chance of success, only what your character knows or can work out. But YES it is certainly within the power of a Wish to achieve this.
You can Wish for anything, anything at all. What actually happens is up to the DM. It is "only" a 9th level spell still and "the greater the wish, the greater the likelihood that something goes wrong.".
If you Wish for a Demon Lord, Dispater for instance, to die, it is likely that the mere 9th level spell will fail to fully achieve that effect, but might instead give you the chance to kill him yourself... suddenly a Gate appears and Dispater steps out, annoyed that his meal of freshly harvested souls has been interrupted.
Wishing that someone's ability to cast Wish be restored seems reasonable, it is a 9th level spell effect against the effect of a 9th level spell. But be very careful how you word it, the DM will probably not let this just happen easily and the ability to cast Wish is a very great thing and, again, "the greater the wish, the greater the likelihood that something goes wrong."
Also it must be pointed out that this use of the Wish spell may incur (33% chance) the same penalty as the original caster suffered, the loss of the ability to cast Wish, so they had better be a brilliant friend, particularly if the attempt fails and leaves both casters without the ability.
Divine Intervention (PHB p.59)
The DM chooses the nature of the intervention; the effect of any cleric spell or cleric domain spell would be appropriate.
While any cleric spell is appropriate, so may other effects be appropriate, based on your DM's judgement. The wording above does not exclude other effects, just gives a "scale". The DM's judgement should definitely include consideration of the deity's domains and spheres of influence (a deity of fate or time or healing or magic is more likely to intervene in this way than one of evil or war etc), but a deity granting anything a Wish can achieve does not seem unreasonable. If the DM thinks it is appropriate. So YES it is potentially within the power of Divine Intervention to achieve this, it all depends on the DM's judgement.
However a Deity has an agenda so don't be surprised, for instance, if the only Wishes you can subsequently make have to promote that agenda, or that the Deity has power of veto over your Wishes. Don't be surprised if a geas like effect is in place. Or maybe you get an audience with the Deity, where you get to convince them or they bargain with you, convince you, threaten you or trick you into joining "the cause".