For what it's worth, being able to attack your own pet is actually valuable sometimes. You can use it to regain health with Vampirism, and sometimes it's the only way to prevent your pet from stepping on a trap and killing you. There should still probably be a less ambiguous command for it, though.
There is afew uses... First is feeding off them with Vampirism (attack em all day then eat their corpse). Also for example fungal arts, you can kill the summon from that then plant a Mushroom on it, as it leaves a corpse, not very efficient but it works. Never thought of the above thought, my pet almost killed me once by running over a trap >.< Haha. But anyway it's a nice mechanic I like it, especially with the whole Vampirism thing. The only fix I'd suggest is to NOOOOOOOOT attack it when it has an item under it.. Have attacked my slime so many times when I'm trying to loot/pick up shrooms =/ That'd be a nice fix.
You switch places with it if you use the keyboard. Also be careful, they can counter you. Might end up killing yourself, Mr Vampire.
I've stopped using Pets as I'm sick of killin it when it Jams me in a 1 tile dead end walkway - just think of how many times you'd have to restart a character if you couldn't kill your pet
Use the keyboard to move.. then you switch places with your pet instead of being blocked. Someone mentioned that earlier in this thread.
AFAIK it does not unless there is an enemy it is trying to reach. Anyway, in the next update I believe they are making it impossible to kill your pet (as well as making it smarter).