It's not so much a bug as it is sloppy programming.

The problem with Hide is that it has the same issue as Benediction and similar skills, where it has to go through a fancy animation before the actual buff is applied. This, combined with server delay as Mholito said, it appears that the Mechanist shot you after you are hidden, when in fact his cast completed before the buff applied.

You see, on your screen at around 0:06 seconds it appeared that the Hide buff was applied while the MCH was at about 40% of his cast, but due to server delay, he already completed his cast before your buff was actually applied. Server delay + fancy animation = results. (Doesn't help if you have slow net as well)

As for the SMN pet, it is an exploit. In some PvE battles, there are moments where the boss is untargetable by players, but you see the egi still attacking it. This coding was obviously never taken into consideration when Ninja was released for PvP.

So yeah, this is not a bug, it is an oversight, but it does need to be fixed.