All perfect praise be to Allaah, the Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
The Sharee‘ah has blocked the way to trickery and threatens the one who uses tricks with the severest of punishment. Regarding the Jews who resorted to trickery to catch fish on Saturday (Sabbath), Allaah The Exalted Says (what means): {And you had already known about those who transgressed among you concerning the Sabbath, and We said to them, "Be apes, despised."}[Quran 2: 65]
What is mentioned in the question is nothing less than breaking and nullifying an obligatory fast. Scholars have unanimously agreed that the person who starts performing an obligatory act of worship is not permitted to break it without a Sharee‘ah-approved excuse. Allaah The Exalted Says (what means): {….And do not invalidate your deeds.}[Quran 47: 33]
Consequently, if that person who wants to change his intention from obligatory to voluntary fasting has a Sharee‘ah-approved excuse such as illness or the like, he can break his obligatory fasting and there will be no need for the trickery. But if it happens to be an invalid excuse, then this will not allow him to change his intention from obligatory to voluntary fasting to break his voluntary fasting.
Allaah Knows best.