stubgen: Use NamedTuple class syntax (#10625)
### Description
Use `typing.NamedTuple` in stubgen, instead of `collections.namedtuple`.
## Test Plan
I modified the existing tests and added another test for an empty namedtuple, to ensure that `Any` is not imported unnecessarily.