I have one suggestion (below, in some detail), but first a few thoughts on your list of possible causes (edit: which seem to have been lost in a thread merge, so I'm now replying to a list that's no longer there):
* It's not Android 11. I've been using that for a year now and never experienced this. Of course it could be that Realme have messed-up their version of Android 11, but that would be a Realme problem rather than an Android 11 problem (see below).
* It isn't the individual phone, because you've changed your phone and have the same problem.
* It would be surprising if it was the network provider, because that would affect a lot of people and produce a lot of complaints. But not knowing who that is it's hard to say more.
* I've no experience of Realme phones, so cannot say whether this is a common problem with them (see first point)
* It's a weird one for a SIM problem, but I can't completely rule that out.
I've one suggestion you can try, but be a bit careful with this:
* Open your phone app. Dial the number *#*#4636#*#* - do not press the call button, just type that number in. On most phones that will take you to a hidden menu called "Testing". If Realme or your service provider have removed that then you don't need to read the rest (though you could see whether an app called "Any Cut" is still available, and if it is see whether that can give you a shortcut to the "Testing" module. If the hidden menu exists but the dialer shortcut has been removed that might still give you access).
* One item in the menu is "Phone information". Select that.
* Scroll down, without changing anything, until you find "Set preferred network type". It will probably show several network types (mine shows LTE/CDMA/EvDo/GSM/WCDMA (PRL), and 2 of those are network types that have never existed in my country). The important question is whether "LTE" is in the list, as that is the protocol used for 4G.
* If LTE is included then you can exit this menu - just return to home via your home button or gesture is fine. That would mean that the problem is not here.
* If LTE is not included, touch the list to see what other options there are. The trick then is knowing the right one for where you live. If it helps, "GSM" is 2G in most of the world, "WCDMA" is 3G for GSM-based networks, CDMA and EvDo are 2G and 3G for CDMA networks (mainly found in North America, rare or non-existent elsewhere), TDSCDMA is I think a China-only technology, and I've no idea what "NR" is, which is the other thing I find amongst my options. Try to set it to something that includes not only LTE but the other technologies appropriate for your network (don't include TDSCMA unless you actually do live somewhere where that is used).
My speculation is that you might find it set to "GSM/WCDMA preferred" (i.e. 2G/3G preferred) or else "CDMA/EvDo/GSM/WCDMA (PRL)". If so this could be the source of your problem, since those would tell the phone not to select 4G connections. If so then changing it here to something that includes LTE might make your selection of 4G actually stick.
* Exit the menu without changing anything else (just return to home is fine). Do not change anything else: this is an engineering test menu, and there are things in there that can cause difficult to fix problems if you mess them up.
That's the only thing I can really think of, other than changing your SIM and hoping that a newer one fixes it or giving up on Realme phones.