If you are like me and are fed up with banging your head against a brick wall for this, there is an invincibility glitch that still works as of the latest update. To do this, you must "get memory" (basically store a charged up super dash while still being able to move) and release it when activating dream gate to break the dream gate's animation right as your character disappears.
To do it you need super dash (charge dash), and dream gate. You can only create memory once per reload of your save so if you don't successfully do the glitch, quit out to the menu then reload your save to try again.
To do the glitch I switched my charge dash from the default [cn_LT] to [cn_A]. That means I moved my jump button from A to LT. By default the quick map button is [cn_LB].
Once you load your save, step off the bench. Do not open inventory (to be safe, don't press anything other than the glitch buttons). Once you are ready, what you want to do is double tap quick map ([cn_LB]). Between the two taps of the double tap, you need to press AND HOLD your charge dash ([cn_A] for me which is why I switched it off of the left trigger, because I had a habit of releasing it rather than holding it since my fingers were thinking of double tap on LB not tap and hold).
So it looks like this with charge dash on the A button: tap [cn_LB], press and hold [cn_A], tap [cn_LB]. This should be done very quickly. If done correct, you will still be holding [cn_A], thus have a charge dash ready for release, but be able to move around freely. While still holding [cn_A] to retain your charge dash, press and hold up on the left stick and [cn_Y] to activate your dream nail dream gate ability. Be ready to release [cn_A] to charge dash the INSTANT your character disappears, before the dream gate successfully teleports you. If the screen goes white, you waited too long. If it doesn't, find an enemy and see if they damage you on impact. If not, congratulations you are invincible and ready to kick the pantheon's butt! If the screen didn't turn white but you aren't invincible, you released the charge dash too soon in the dreamgate animation. To try again, you will need to quit out to the main menu, reload your save, and re-establish your 'memory' charge dash again via the [cn_LB], hold [cn_A], [cn_LB] sequence again.
I will try and put up a video or at least an Xbox clip of this soon, but if you search Youtube for "Hollow Knight invincibility glitch" there is a 2 or 3 minute video that shows this glitch and explains it, although the explanation might sound a little confusing. I tried to make it as easy to understand as possible here.
If you successfully gain invincibility, it will last until you quit out of the game. You can go through pantheons, roam around the map, rest at benches and swap out charms, fix your controls back to default or your preference, etc so long as you don't quit out of the game.