You do not need to go through Mexico Immigration at all.
You just cross the US border (step into Mexico land) and then immediately turn back to enter USA.
In this whole process, you never even see any Mexico immigration counter.
If US does not let you re-enter from Mexico border?
In the unfortunate case of rejecting your entry in USA (it is possible), you will need to go into Mexico as that would be the only option left for you.
Your US visa/ i797 are valid to enter Mexico. So, no need to worry about applying for Mexico visa separately.
Crossing the border is your choice
If the immigration officer asks you to cross the US border and re-enter to update your i94, then it is your choice to take that chance or not.
They do NOT force you. You are still on US side and safely come back to your home (if you decide to NOT cross border) and use other methods to extend your i94.