Its actually
rebuilding for class levels, not retraining. Fine distinction, I know, but the book gives both those words a specific game meaning, so it is important to be clear
Now that I've got the semantics out of the way, I can answer your question. Yes, it works, with the caveat that the DM has to approve of it and, if approved, your character has to complete a quest. The book specifically mentions rebuilding for power as a potential problem, so take care.