Or is it something different, a purely literary device with an outside observer necessary for there to be irony?
It's certainly about communication (Of course you can also communicate with yourself). Irony greatly broadens the palette of expression, at the price of more uncertainty in understanding - I would almost class irony among idioms.