custom CSS gets stripped out of posts because someone could do something like border: 1000px solid gray
and make the whole topic unreadable
You need to add some CSS to a theme or a theme component to do this, no great way around it. You can make it optional on an image-by-image basis though.
So for example, you can add this CSS to a theme:
div[data-theme-image-border] img {
border: 1px solid gray;
}
and then use it in a post like this:
<div data-theme-image-border>
<img src="yoururlhere"/>
</div>