Anyway, I have just created the solution (solution or workaround, others may judge). If you have encountered this page by looking for a solution, congratulations.
I created a script that solves this situation by copying the second and next-to-last keyframes before and after the first and last keyframes, forcing the curve to interpolate and removing those keyframes leaving the interpolation untouched.
Here it is: https://github.com/aravergar/cyclic-animation-interpolation