I rarely use that keyboard, but once in a while you just need to type something in a terminal or a remote desktop or something, and it really comes in handy then.
Undo has been available in the Alt Menu of GBoard for a while. Long press on an editable text field then select Undo in the popup alternative menu (sometimes you need to scroll over or tap the 3 dots to see the full menu choices)
The options that you see there are not dependent on your keyboard though. Change your keyboard to something else, and you still see the same options when long pressing a text field.
It's the best replacement for Google keyboard I've tried by a wide mile. I like the gestures it has by comparison, they allow finer control. It's also very stylish. I'll probably use it for a long while.
With an OTG connector you can just plug a keyboard into your phone. You can do stuff like alt-tab to switch between open apps. And if you plug in a mouse, a giant cursor appears. It's kinda cursed but it works.
A thing I did with Key Mapper from F-Droid lets me undo by pressing Volume Down + Volume Up, and Redo by pressing Volume Up + Volume Down (the order matters). If anyone's interested I can share how to set it up.
Note that it'd work better and more seamlessly if you use Shizuku, but I don't so there's some caveats. I'll happily go into more detail if anyone wants, just ask.
Uuhh, I know we are talking about phones. But the stock keyboard supports all desktop shortcuts when Android runs on a tablet. Like, I'm using them right now on a Samsung A8.
Well, I'm downtown right now and I no longer have my tablet with me. But here's from the horse's mouth. It says Galaxy Tab S, but it applies to all Galaxy tablets. There you can see the ctrl key on the tablet's default keyboard. That key has full functionality for the common shortcuts. That's undo, redo, copy, cut, paste, and select all. I use them all the time ever since I got it. Both tablets and phones can undo and redo if you connect a bluetooth keyboard to them too.
The Samsung keyboard for phones also acquires the powers of undo and redo if you activate the swipe gestures.
I don't know why it is so simple on the tablet but not on the phones, but whatever. It's a UX quirk, it's not some magic that the keyboards are creating. Android has an UndoManager right in the OS since before 2018. It is what apps that have undo buttons use themselves.
I’m always kind of surprised that, Google has yet to follow iOS in having universal, system wide, undo / redo shortcuts.
Back in iOS 1 and 2, we used to mock Apple for lacking universal undo. Then they added that shake to undo feature in iOS 3. That gesture is stupid as hell, and the newer three finger gestures are also kind of janky, but at least they work everywhere.