[FX] Make `immutable_list` and `immutable_dict` work with pytrees (#73766)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/73766
Test Plan: Imported from OSS
Reviewed By: zou3519, Chillee
Differential Revision: D34630217
Pulled By: jamesr66a
fbshipit-source-id: f23420deaeed7e54d5e6759b486ca4a02243a7b3
(cherry picked from commit 8854c60e60e79b144077f3021d305ea3d06a2a21)