When I upload an image via the editor dialog, it automatically links back to itself.
I would like the option to specify custom URL instead, which it would link to, e.g. by adding a textbox in the image upload dialog.
Yes, you can provide a custom image source URL and a custom link URL as well.
The generated image markdown actually consists of two parts: The image itself and the link. Usually the same URL is used for both, but you can specify two separate URLs if you want:
[![description]] : https://upload.wikimedia.org/wikipedia/commons/b/bb/First_abstract_watercolor_kandinsky_1910.jpg : https://en.wikipedia.org/wiki/Abstract_art
 is the URL for the image and
 for the link.