[jit] move get_annotations out of infer_concrete_type_builder (#105197)
There's an internal use case for get_annotations - basically
1. make a module
2. copy annotations from the module to a fx-traced module
3. script the fx module
This isn't a public API but for internal use it's probably fine to reuse this logic instead of copying.
Differential Revision: [D47460370](https://our.internmc.facebook.com/intern/diff/D47460370/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105197
Approved by: https://github.com/eellison