You're slightly misunderstanding what Vim is doing here. When you do
d4b, there is only a single action, which deletes from the current position to the position where
4b would jump to.
The behaviour that you see when you undo with
u is not that Vim is undoing the
d but leaving the
4b motion intact. What's actually happening is that when Vim performs an undo, it places the cursor at the beginning of the change that is undone.
(If you do
d4wu, you will see that the cursor stays the same location throughout: it does not end up at the end of the motion, as your interpretation would suggest.)
If you're writing a script/function there are workarounds you can use to move the cursor back to its location prior to the undo, but unfortunately, there's no general command that can always do this: it requires you to know before you make the edit that you're going to want the cursor position restored after an undo.
Unless you are lucky and find that the location happens to already be saved in an automatic mark as the result of another action (see
:help mark-motions), I'm afraid it's not possible to restore the location of the cursor in the way you desire.