This seems a no-brainer: Remove voting buttons for logged-on user's posts.
If there were no buttons on my posts, there wouldn't be a need for the "You can't vote for your own post" message, because it would be impossible to vote for your own post.
The way it currently stands is actually nonsensical, because you can vote for your own post - there's a button right there and I can click it - but when I vote for my post I get an error message.
Put another way, there's an active control presented to the user that will always and can only produce an error. I'm not a UX design expert, but that doesn't sound like good design to me.
Notwithstanding a backend check to prevent malicious calls.