I think you should be able to modify your z-sorting code to divide walls between two layers. Move walls that are behind the player to a layer below, and move walls that are in front of the player to a layer above. And then make a hole in the front layer with the mask sprite and blend mode.
However, if there are other objects like enemies, that should not be erased, then this will not work.
There may be a workaround with Paster plugin. Paste front walls on a Paster object, make a hole, display the Paster object and hide the real walls.