I did a little more digging to see what could cause this...
Firstly, disabling 2G is a feature added by Google to AOSP, so if we were to consider this a bug it would most likely be considered an upstream one. I checked Google's issue tracker, but I didn't see any reports of this issue for many years, most of which are labeled as "obsolete."
If it's not an upstream bug, I have another hypothesis...
GrapheneOS uses AOSP carrier settings, but changes them a little. The website explains it best:
The OS has a database of APN and other carrier configuration settings which determines how this works by default. Normally, carriers can force their configuration choices on users by making APNs read-only and disabling various configuration options. GrapheneOS ignores this and always allows configuring APNs, APN types, changing preferred network mode, toggling off 2G and using tethering regardless of what the carrier wants.
So, GrapheneOS allows you to disable 2G even if your carrier specifically forbids it in the carrier settings. The GrapheneOS script simply ignores that setting when parsing the carrier settings file.
(@treequell posted while I was writing this, thanks treequell!)
Considering MMI codes don't work for you with 2G disabled, but they do work for treequell, then I can only guess your carrier doesn't support disabling 2G yet. I'd suggest you either keep 2G enabled or temporarily enable it when checking your balance.