It has to do with the fact that neither of your parent pages have proper links in the menu (one has no link and the other goes to http://X ). This solution applies specifically to those who want to keep the parent links functional.
Replace the custom placeholders you have now with proper pages in your menu and you might solve the problem.
If the suggestion above doesn't solve the problem, please remove the snippet so I can take a look at how your menu looks normally and realize why it's not working.
The real problem is that, in your installation, the class "open" does not get applied to the parent's containing li, therefore your submenus do not open for mobiles. I have to see if this also happens without the snippet, or it is caused by the preg_replace.