Try this for the code from lines 3330 to 3347. The change to line 3331 forces the series_id to the series name if the book is not sideloaded.
Code:
if self.supports_series_list:
series_id = new_series if not book.is_sideloaded else self.kobo_series_dict.get(new_series, new_series)
try:
kobo_series_id = book.kobo_series_id
kobo_series_number_float = book.kobo_series_number_float
except Exception: # This should mean the book was sent to the device during the current session.
kobo_series_id = None
kobo_series_number_float = None
if not book.is_sideloaded or series_changed or series_number_changed \
or kobo_series_id != series_id \
or kobo_series_number_float != newmi.series_index:
update_values.append(series_id)
set_clause.append('SeriesID')
update_values.append(newmi.series_index)
set_clause.append('SeriesNumberFloat')
if show_debug:
debug_print(f"KoboTouch:set_core_metadata Setting SeriesID - new_series='{new_series}', series_id='{series_id}'")