bpo-45663: Fix is_dataclass() for dataclasses which are subclasses of types.GenericAlias (GH-29294)

(cherry picked from commit 446be166861b2f08f87f74018113dd98ca5fca02)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index fe4094b..105a95b 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -1211,7 +1211,7 @@ def _is_dataclass_instance(obj):
 def is_dataclass(obj):
     """Returns True if obj is a dataclass or an instance of a
     dataclass."""
-    cls = obj if isinstance(obj, type) else type(obj)
+    cls = obj if isinstance(obj, type) and not isinstance(obj, GenericAlias) else type(obj)
     return hasattr(cls, _FIELDS)