I needed this for a tamper monkey script, and feel this might help you compile what you need or extend the logic, to get the product id from a given shopping cart item within the checkout using jQuery and knockout in tandem.
// Load the contexts when needed
let jQuery = require('jquery');
let ko = require('knockout');
// use jQuery to get all the items in ...
Your html is broken, you shouldn't have a <div> wrapping an <li> element. The parent should be a <ul> element. If you had the correct <ul> element, you would set the css of the <ul> to list-style:none;
<li><a href="#">Link 1</a></li>
Edit your catalog_product_view.xml file, move the media gallery block to your custom block
<move element="product.info.media" destination="your_block_name" as="product.info.media" />
After that you can call media gallery block to your custom phtml file like below
<?= $block->getChildHtml('product.info.media') ?>