I don't believe we have found a way to conditionally cast a spell depending on if targeting self or others. Essentially I was asking the same question (with different functionality, but it all comes down to can I find out if I'm targeting myself) in the following thread:

Macro that if targeting self use barkskin, if targeting another player then heal

There are some interesting ideas with playing with tartget=targettarget and so on, but I'm not sure if there was a functional solution in the end.