You could try permalink normalization site setting. It’s designed to solve a problem that is at least similar.