Hackers Keyboard has that via ctrl+z, but only in horizontal mode. For this only i had my Galaxy S3 in horizontal per default. But can't do that with modern phones' aspect ratio and i'm missing undo since then.
Heliboard, if you hit that little ">". Highly recommended as it works well and one doesn't need the google keyboard. Can also do multiple languages at once.
Undo is a function of the Android API, not the keyboard. All phones can do it. It is usually the app's responsibility to implement its button because the feature extends beyond the realm of text input.
This has been one of my major complaints moving from iOS to Android, iOS has (had?) the "shake phone to undo", and I used it often. So far no keyboard I like enough to use as my main has had undo easily accessible, it annoys me several times a week.