[dynamo][rewrite_asserts] Insert assertion msg in bytecode only when needed (#105549)
Fixes https://github.com/pytorch/pytorch/issues/105513
The main issue is that we could call `self.LOAD_CONST` and change Dynamo stack, and then decide that we can't rewrite it later. This PR ensures that we change the dynamo stack only when we decide to rewrite asserts.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105549
Approved by: https://github.com/tugsbayasgalan