How to use transients and variables

You’re saving the data in a loop under the same key for each iteration. You’ll have to add the index of the current iteration of the loop to the key if you want a unique value for each. Something like:

$i = 0;
while ( have_rows('images') ): the_row();
  fragment_cache('cms_images_text_' . $i . '_' . $post->ID, WEEK_IN_SECONDS, function() {
    $gallery_image = get_sub_field('image');
    $gallery_image_small = $gallery_image['sizes']['square-small'];
    echo '<img src="' . $gallery_image_small .  '">';
  });
  $i++;
endwhile;

Or perhaps just save the entire loop’s contents under a single key.