Turns out the process is simple.
First, reset the permalinks to the old permalinks.
Then, using the RankMath plugin, from general settings –> Auto post redirect, activate this option and make it on.
Then, change the permalinks structure to the one you desire, and the plugin will automatically do it for you!