God is not tricked. There is no restriction against cooking on Shabbat. There are restrictions against eg. making a fire and building. If you can somehow cook without doing any of those things, then there is nothing wrong with it.
https://en.wikipedia.org/wiki/Grama_(halacha)
Grama really only helps you for rabbinically prohibited actions. (i.e. man made law, man made loophole). Not law that is considered biblical in nature.
Most people who wonder about all the "loopholes" don't realize that its talking about what jews considered rabbinic law.
to make an analogy, congress can't legislate a loophole around the constitution, they can legislate loopholes around their own laws.