The short answer is: you can’t. If you change the Caller ID, that is going to be reflected in the CDRs.
The long answer: due to many of the architectural changes made in Asterisk 12, CDRs were completely rewritten. Much of the rewrite enforced a standardization on the behavior, such that the CDRs behave the same way regardless of the dialplan written. While this has made things a lot more predictable, some functionality was tweaked/modified/altered. Unfortunately, that was unavoidable.
As I said, if you want to record the extension number in a CDR and you want to modify the Caller ID, you can always store it in a custom field.