This is what I have in the LI for the Gutenberg gallery (swapped out actual links for placeholders).
<li class="blocks-gallery-item">
<figure>
<img width="300"
height="292"
src="https://imagepath-300x292.jpg"
data-src="https://imagepath-300x292.jpg"
alt="altTitle"
data-id="86906"
data-full-url="https://imagepath.jpg"
data-link="https://imagepagepath/"
class="wp-image-86906 lazyloaded"
data-srcset="https://imagepath-300x292.jpg 300w, https://imagepath-100x97.jpg 100w, https://imagepath.jpg 600w"
sizes="(max-width: 300px) 100vw, 300px"
srcset="https://imagepath-300x292.jpg 300w, https://imagepath-100x97.jpg 100w, https://imagepath.jpg 600w">
<noscript>
<img width="300"
height="292"
src="https://imagepath-300x292.jpg"
alt="altTitle"
data-id="86906"
data-full-url="https://imagepath.jpg"
data-link="https://imagepagepath/"
class="wp-image-86906 lazyload" srcset="https://imagepath-300x292.jpg 300w, https://imagepath-100x97.jpg 100w, https://imagepath.jpg 600w" sizes="(max-width: 300px) 100vw, 300px" />
</noscript>
<figcaption class="blocks-gallery-item__caption">imageCaption</figcaption>
</figure>
</li>
If I disable all of my image plugins, I get the following but the link still doesn’t work
<li class="blocks-gallery-item">
<figure>
<img loading="lazy"
width="300"
height="292"
src="https://imagepath-300x292.jpg"
alt="altText"
data-id="86906"
data-full-url="https://imagepath.jpg"
data-link="https://imagepagepath/"
class="wp-image-86906" srcset="https://imagepath-300x292.jpg 300w, https://imagepath-100x97.jpg 100w, https://imagepath.jpg 600w"
sizes="(max-width: 300px) 100vw, 300px">
<figcaption class="blocks-gallery-item__caption">imageCaption</figcaption>
</figure>
</li>