Air was beaten into the custard before it went in
Very commonWhisking hard, or beating at speed in a mixer, folds air into the mixture. In the oven that air expands and the setting egg holds it, so the filling domes or souffles well above the rim. Nothing in a custard is built to keep that volume — there is no gluten and no starch network — so as it cools the air contracts and the surface sinks, usually below where it started. A cracked, sunken top on a cheesecake and a quiche that puffed and then fell are the same mechanism in two products.
What to change
Mix the custard slowly, and stop as soon as it is uniform
Combine with a whisk used gently, or a mixer on its lowest setting, keeping the whisk under the surface. Scrape the bowl and fold rather than beating to clear lumps. If the surface has a layer of foam before it goes in the oven, let it stand a few minutes and skim it.
Any baked custard filling, and especially cheesecake batter made in a stand mixer.
Trade-off: Takes longer to get smooth, which is why bringing the ingredients to room temperature first matters so much.