As the current workaround, how about this method?
Issue and workaround:
In the current stage, unfortunately, it seems that this bug is still not resolved. By this, in your case, the 1st selected image cannot be retrieved. I think that this is the current reason of your issue.
In order to achieve your goal, as the current workaround, I would like to propose the following flow.
- Select an image which is used as the basic size and script is run.
- The object ID of image is saved to the PropertiesService.
 
- Select the images you want to resize and the script is run.
When your script is modified for this flow, it becomes as follows.
Modified script:
function allMenu(){
  var slideUi = SlidesApp.getUi();
  slideUi.createMenu('LAK')
      .addSeparator()
      .addSubMenu(slideUi.createMenu('Sizes')
      .addItem('Select base image', 'selectBaseImage')  // Added
      .addItem('Same Size', 'sameSizeElements'))
      .addToUi();
}
// 1. At first, it saves an image which is used as the base image.
function selectBaseImage() {
  var selection = SlidesApp.getActivePresentation().getSelection();
  var pageElements = selection.getPageElementRange().getPageElements();
  if (pageElements.length == 1) {
    PropertiesService.getScriptProperties().setProperty("baseImage", pageElements[0].getObjectId());
  } else {
    throw new Error("Select one image.");
  }
}
// 2. As the next step, the selected images are resized using the saved image.
function sameSizeElements() {
  var prop = PropertiesService.getScriptProperties();
  var objectId = prop.getProperty("baseImage");
  if (objectId != "") {
    var selection = SlidesApp.getActivePresentation().getSelection();
    var baseImage = selection.getCurrentPage().getPageElementById(objectId);
    var pageElements = selection.getPageElementRange().getPageElements();
    for (var i = 0; i < pageElements.length; i++) {
      pageElements[i].setWidth(baseImage.getWidth());
      pageElements[i].setHeight(baseImage.getHeight());
    }
    prop.deleteProperty("baseImage");
  } else {
    throw new Error("Base image was not found.");
  }
}
Result:

References: