stubgen: fix handling of Protocol and add testcase (#12129)
### Description
This PR fixes #12072 by correctly handling `Protocol` definitions. Previously, the `Protocol` base class was removed when generating type stubs which causes problems with other packages that want to use type definition (because they see it as a regular class, not as a `Protocol`).
## Test Plan
Added a testcase to the stubgen testset.
Co-authored-by: 97littleleaf11 <11172084+97littleleaf11@users.noreply.github.com>