This is incorrect. You can relicense your code to whatever you want if you and all the license holders agree to do so. You can’t unlicense the old code, though, and if there are more license holders than just you, it’s probably more complicated than it’s worth.
have to rewrite anything AGPL
I’m skeptical this would actually hold up in court because if you wrote the original code and then wrote the new code, it would not be clean room design and would most likely be breaking the terms of the original license.