The transformation is just needed to automatically add a link around the image. Then you need to make that link point somewhere. You could also resize at the same time or do other modifications. So you also need a target location. You could add a new viewer by adding a gallery.vm template in your skin for example and in that galley.vm, display all images attached to the current page using the gallery macro.
That would make a nice extension
BTW if you’re interested to have this but don’t want to develop this, you could also consider asking one of the companies sponsoring the development of XWiki to do it for you. I’m sure XWiki SAS would like to do this for example and IMO it would cost only a few days of dev. Note that XWiki SAS does rebate when asking to develop something that goes back as open source in the community, so that could be something to consider.