Fixed Python+upb to use ScalarMapContainer when appropriate.

PiperOrigin-RevId: 457980556
diff --git a/python/map.c b/python/map.c
index 5e0f6ab..c3711ae 100644
--- a/python/map.c
+++ b/python/map.c
@@ -30,6 +30,7 @@
 #include "python/convert.h"
 #include "python/message.h"
 #include "python/protobuf.h"
+#include "upb/def.h"
 #include "upb/map.h"
 
 // -----------------------------------------------------------------------------
@@ -84,8 +85,11 @@
 PyTypeObject* PyUpb_MapContainer_GetClass(const upb_FieldDef* f) {
   assert(upb_FieldDef_IsMap(f));
   PyUpb_ModuleState* state = PyUpb_ModuleState_Get();
-  return upb_FieldDef_IsSubMessage(f) ? state->message_map_container_type
-                                      : state->scalar_map_container_type;
+  const upb_FieldDef* val =
+      upb_MessageDef_Field(upb_FieldDef_MessageSubDef(f), 1);
+  assert(upb_FieldDef_Number(val) == 2);
+  return upb_FieldDef_IsSubMessage(val) ? state->message_map_container_type
+                                        : state->scalar_map_container_type;
 }
 
 PyObject* PyUpb_MapContainer_NewStub(PyObject* parent, const upb_FieldDef* f,