The problem isn’t the glass - it is the drink - by adding some gallium to your drink - you should be able to make it so it is solid at (not too hot) room temperatures and liquid when activated by your body heat.
Of course I’m guessing you wouldn’t survive very long, but that is the price you pay for progress.
I think a small amount of Xanthan gum would do a better job. It would solidify the liquid and is perfectly food-safe. Sure, you now have to eat your drink, but frankly that sounds like an advantage.
The glass itself doesn’t have to have a wide base. You just need something you place a glass into that has a wide base. For instance, buy lunchmeat that is packaged in a plastic tub, e.g., Packaged Lunch Meat | Butterball . Remove cover and lunchmeat. Cut hole in cover a little wider than the glass (it doesn’t have to be snug). Replace cover. Insert glass.
That should give the glass sufficient stability for your purposes. If you want a taller base, a dollar store might have some suitable container with a plastic cover.
Here’s a design, feel free. Should work pretty well, as long as you have a ferrous/magnetic surface to stick it on. Construct a base with an array of permanent magnets pivoted on their center, with a mechanism attached to a squeeze handle so that when you grab the glass and squeeze the handle, it pivots the magnets away from up/down orientation to side to side. When you put the glass down and release it, the spring loaded handle re-orients the magnets facing down and the glass magnetically sticks to the surface.
Get the benefit of magnetic holding power while using grip before lift to break the attachment, removing the “jerk” from just pulling away an attached magnet. Similar to a magnetic chuck for machining, btw, so prob not patentable, ha.
Head for your nearest boating supply store. I’ll bet you they’ve got something that’ll ffit your needs. I know they carry coffee mugs that are are impossible to tip over (being wider at the base and narrowing towards the top). I bet they’ve got something similar that’ll hold a can of pepsi and some ice.