I also think it was part of his plan to get “tricked” by Cinderella and company. If you watch the scene in The Price of Gold, he seems to know she is trying to capture him using magic. I think somehow being in the prison preserved some of his memories as the curse was enacted. Not sure how, but I think it blocked some of the memory wiping properties of the curse.