Could Gaster escape? Since the beginning of the Glitch caused by flowey that ripped time and space allowing the void itself to enter the underground and if he could would he be no longer immune the the hunger and go insane like the rest?

There is a tear in the fabric of the world that Gaster could technically slip through, but he would still perish if he lingered overlong in the physical world. He perished, as he fell into the Void, and thus became a creature of the Void itself. As physical beings cannot exist in the Void for more than a few seconds, so too can Void creatures not linger in the physical world.