You gave him 100 Usd, I need just as much; meaning: I need just the same amount.
Just as I told you, you never have to talk to strangers; meaning: behave just the way I told you.
I don't think much can be replaced in the first sentence without changing its meaning.
This expression is fairly common, and you have understood its general usage pretty much correctly, although that common usage is questionable.
It is a misapplication of the idea of ‘behalf’. To do something on someone's behalf is to do that thing because that is what that person or organisation would do if they were present (i.e. you do it in the spirit of representing them), or because you think and hope that this action will benefit them (see Merriam-Webster).
Basically, if you do something on someone's behalf, you do it because they are absent but you are sure that this is what they would want if they were present, and also you respect or care about that view (whether or not you agree with it) sufficiently to want that impulse or principle to be upheld. This can be by prior arrangement (e.g. voting by proxy) or an individual act (e.g. assassinating Archduke Franz Ferdinand).
I would deliver my racist friend’s vote on his behalf, not because I support it (my own vote would oppose it) but because I respect his right to vote, while he is in hospital.
A simpler, more common and (in my view) more elegant and correct expression for what you describe is, ‘I am delighted [or pleased, or excited, etc.] for you.’
Essentially you are then saying that someone else’s good fortune gives you pleasure. ‘Behalf’ does not really come into it.
Best Answer
My dad used to use that term to mean "to use too much" like, when some dish is too salty, he'd say "Wow - that's salty!! Looks like you stubbed your toe there."