I think that's different because refactoring usually involves calling the same functions/methods albeit in a bit more readable way.
When not given a clear guideline to "just" refactor, I have had problems with LLMs hallucinating functions that don't exist.