First Answer: Not Easily.
So, I'll assume you're talking about prepping a wish-glyph prior to losing the ability to cast wish. At that point, you should be able to cast a 9th-level Glyph of Warding, and you should be able to cast a 9th-level Wish. Unfortunately for you, it's not that easy, as you have to cast them at the same time, and the only way to get a character with two 9th-level spell slots is via Boon of High Magic... with means that either your DM is being exceedingly generous with you, or you're in a campaign that hit 20 some time ago, and have been collecting Boons. That's not normal state, even among casters who can cast Wish.
Now, it's still doable, even without extraordinary Boons. You could write the Glyph of Warding onto a spell scroll, and then use that for the combined casting. It's rather more time-consuming and expensive, but it would be doable.
Of course, you're using Wish. You could just Wish for a Wish-glyph to cast this particular Wish on you, and save yourself the extra slot issue. That... has issues we'll cover a little later on.
Second Answer: Not Safely
Even after you get over that hump, though, you're still dealing with Wish... and you're doing so on an entirely custom effect. The text for wishing with custom effects is as follows:
You might be able to achieve something beyond the scope of the above
examples. State your wish to the GM as precisely as possible. The GM
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. For example, wishing that a
villain were dead might propel you forward in time to a period when
that villain is no longer alive, effectively removing you from the
game. Similarly, wishing for a legendary magic item or artifact might
instantly transport you to the presence of the item’s current owner.
I don't know about you, but that doesn't fill me with confidence that This Will Definitely Work... and phrases like "unable to cast wish ever again" (as contrasted to something like "lose the ability to cast wish") don't help any.
Finally, it's worth noting that casting wish into the Glyph in this way is exactly the sort of wish-casting that might lose you your ability to cast wish.
So... you could try to set up this contingency, yes. Assuming you haven't been granted the Boon of High Magic, it will be somewhat costly and/or time consuming (scribing 9th-level scrolls ain't cheap), there's a 1-in-3 chance that you'll have to trigger your contingency in the setup process, and there's a good chance (with a lot of DM fiat) that it'll fail utterly or that something else goes wrong. Still... it might work.
As for Wishing for a Wish-glyph, that's just compounding your issues here. It means two nonstandard Wish effects for the DM to adjudicate instead of just one. There's also that bit about "the greater the wish, the greater the likelihood that something goes wrong". Asking your Wish spell to shoulder the load of a Glyph in addition to its other burdens seems like it would make that Wish at least a bit "greater" for those purposes. Given how much this plan is digging into its shenanigans budget already, it's probably better to just pony up for the scroll.