Question about drain trap - limited space in cabinet
You're right. You don't want an S trap. They are against code. I think your idea to extend the drain up the wall is the right way to go. I'm not aware of any code issues with a short, vertical drain as you're proposing it. This will give you the vertical space you need to install a proper P trap. Make sure that when you install the horizontal piece from the P trap to the drain that you allow for a 1/4" per foot slope in the line.