gh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572)

(cherry picked from commit c8c6113398ee9a7867fe9b08bc539cceb61e2aaa)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
4 files changed