Just a thought => can you toss one pyramid out - if you have the 2nd in your inventory and so get out of this mess?

Or this: where is your 2nd pyramid? Can you teleport yourself to this spot then?