model.summary() broken for custom models subclassed from keras.Model
### Current behavior?

**Custom model classes built from keras.Model do not think they get built properly, and the model.summary() is missing information.** However, the model will run just fine. In keras version 2.15.0, we see it working properly, for example (from "code to reproduce," taken exactly from [keras documentation](https://keras.io/api/models/model/#by-subclassing-the-model-class)), the output is as expected:

```
Model: "my_model"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 dense (Dense)               multiple                  352       
                                                                 
 dense_1 (Dense)             multiple                  165       
                                                                 
=================================================================
Total params: 517 (2.02 KB)
Trainable params: 517 (2.02 KB)
Non-trainable params: 0 (0.00 Byte)
```

In keras 3.2.1 and keras-nightly ([colab](https://colab.research.google.com/gist/SuryanarayanaY/4978624270e8883613a278b5de451af7/65436.ipynb)), we instead see this:

```
/usr/local/lib/python3.10/dist-packages/keras/src/layers/layer.py:360: UserWarning: `build()` was called 
on layer 'my_model', however the layer does not have a `build()` method implemented and it looks like 
it has unbuilt state. This will cause the layer to be marked as built, despite not being actually built, which 
may cause failures down the line. Make sure to implement a proper `build()` method.
  warnings.warn(
Model: "my_model"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ Layer (type)                         ┃ Output Shape                ┃         Param # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ dense (Dense)                        │ ?                           │     0 (unbuilt) │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ dense_1 (Dense)                      │ ?                           │     0 (unbuilt) │
└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘
 Total params: 0 (0.00 B)
 Trainable params: 0 (0.00 B)
 Non-trainable params: 0 (0.00 B)
```

While it doesn't break model training and inference, I still think it's an important issue, because I often rely on the model.summary() to check my work as I develop. Thank you to whoever helps out.

### Standalone code to reproduce the issue

```shell
import keras

class MyModel(keras.Model):
    def __init__(self):
        super().__init__()
        self.dense1 = keras.layers.Dense(32, activation="relu")
        self.dense2 = keras.layers.Dense(5, activation="softmax")

    def call(self, inputs):
        x = self.dense1(inputs)
        return self.dense2(x)

model = MyModel()
model.build(input_shape=(None, 10))
model.summary()
```


### Relevant log output
(repeat from above)
```shell
/usr/local/lib/python3.10/dist-packages/keras/src/layers/layer.py:360: UserWarning: `build()` was called 
on layer 'my_model', however the layer does not have a `build()` method implemented and it looks like 
it has unbuilt state. This will cause the layer to be marked as built, despite not being actually built, which 
may cause failures down the line. Make sure to implement a proper `build()` method.
  warnings.warn(
Model: "my_model"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ Layer (type)                         ┃ Output Shape                ┃         Param # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ dense (Dense)                        │ ?                           │     0 (unbuilt) │
├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤
│ dense_1 (Dense)                      │ ?                           │     0 (unbuilt) │
└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘
 Total params: 0 (0.00 B)
 Trainable params: 0 (0.00 B)
 Non-trainable params: 0 (0.00 B)
```