[dynamo][refactor] Use TYPE_MATCH instead of manually constructing guard (#120140)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/120140
Approved by: https://github.com/jansel, https://github.com/yanboliang
ghstack dependencies: #120132