There are actually three similar functions in .bashrc that override su, sudo, and ssh.
I don’t think it’s possible to do what you’re thinking of - one piece of code for multiple commands. And even if it was possible, I wouldn’t do it. The readability of the scripts is also important, which I have painfully learned many times when returning after many months or years to my old overcombined scripts.
Also in Mabox, when I touch old scripts, sometimes my head really hurts before I understand what’s going on. Then I think to myself: What idiot wrote that?
Sometimes… if it works well, it’s better not to improve