It isn’t a joke-within-a-joke, as there’s only one. It’s an example of self-reference.
From the Stanford Encyclopedia of Philosophy:
In the context of language, self-reference is used to denote a statement that refers to itself or its own referent. The most famous example of a self-referential sentence is the liar sentence: “This sentence is not true.”
There’s a Wikipedia entry for self-referential humour:
Self-referential humor or self-reflexive humor is a type of comedic expressionthat—either directed toward some other subject, or openly directed toward itself—intentionally alludes to the very person who is expressing the humor in a comedic fashion, or to some specific aspect of that same comedic expression.
Searching “self-referential humour” or “self-referential joke” finds many examples, e.g. here
Repeat after me, "I will think for myself."
Condemn ambiguity and other stuff.
The technical term for "being unable to remember the word you want" is ...erm...
I never make predictions. I never have and I never will.
I went to a bookstore and asked the saleswoman, “Where's the self-help section?” She said if she told me, it would defeat the purpose.
And my favourite: "Give credit where credit is due." –Unknown
The common factor seems to be that the statement or anecdote is funny because it refers to itself, or one of its elements, in a way that defeats its face-value meaning or purpose.
For some reason, it appeals especially to computer scientists/professionals and mathematicians.