"How do you do" is a simple greeting or salutation.
how do you do — a polite greeting that you can use when first introduced to someone
A more modern variant would be, "How are you?" or "Nice to meet you."
As for usage trends, NGrams can give us a small hint at when it began to phase out of style. Note the decline between 1900 and 1920:
I don't speak German, but from the examples you've given I would say that the English and German usages are similar, but not identical. In English, it's almost always a rebuke, rarely a warning. It refers to forgetting about social rules, and your place within them. The expression can be mild or strong depending on the tone of voice, the speaker and the context.
In your examples:
John, we are going out to dinner tonight. Please don't forget yourself.
A mild rebuke. John has behaved badly in the past, and the speaker is gently requesting that he control himself tonight. Depending on the tone of voice, this could be a desperate plea from someone who feels slightly inferior to John (and therefore doesn't want to use stronger language) or a patronising order from someone who feels superior to John to the extent of treating him like a child.
I believe you forget yourself sir!
A strong rebuke from a social equal or superior. The speaker is very angry, and yet is trying to stay within the social rules himself.
I'm forgetting myself. I haven't offered you a drink yet!
The speaker has caught himself out in a social error, and is at once acknowledging his mistake and apologising for it. It's a mild self-rebuke, although tone of voice and context will show how embarrassed the speaker feels over the faux pas.
As you can see, it's all about context. The expression is almost never used in isolation, so the context is usually plain. The third one is probably the most common, though.
Finally, can this expression used as a threat or warning as in German?
It can, but it's not common. In English, such a threat would usually be wrapped up in a few more words. ("If you don't stop that, I might have to forget I'm a gentleman.") Like the second example, above, the speaker is trying to stay within the rules himself, while making it clear that he finds the other person's behaviour unacceptable. However, as social rules erode, this usage is becoming increasingly old-fashioned.
Best Answer
There are two aspects to your question:-
There is a use of 'very', to modify an adjective. It intensifies it. So, if I say "It is very cold in here", it intensifies the word cold. If I call Jane clever and Amanda very clever, you will gather not merely that Amanda cleverer than Jane, but that she is a great deal cleverer.
But very also modifies (and so intensifies) nouns, as you can see from the definition and examples set out in definition c of the Cambridge English dictionary online.
In this use it can sometimes be replaced by 'actual', as in these examples. In the passage quoted, the speaker is swearing an oath by him/herself. To emphasise the point, s/he does not say just "I swear by myself" but I swear by my very self, so splitting the my from the self.
Which brings me to the word 'by'. To swear by something is less common that it used to be. But everyone is familiar with courtroom dramas in which the defendant says "I swear by Almighty God that I shall speak the truth, the whole truth and nothing but the truth.". The practice continued today, though enlightened states also allow the defendant to "affirm". the idea is that nobody would dare to swear a false oath to God, because of the eternal penalty that might follow in the afterlife. Similarly, people have been known to swear "by this right hand". Presumably the idea is that they would be willing to have it cut off if they were found to have lied. Swearing "by my very self" is thus a kind of extreme promise. How could anyone possibly promise falsely him/her very self?