I had a bonded pet BBB, Nedwin, (before I understood about their dramatically shortened lifespan) who did as you said, with the frontal /rear attacks.
I trained him out of that by confronting him every time he bumped me, and, raising my knees up & bumping him with my shins while walking into...