You must convert your polygon layer to a point layer. The "Data Defined Size Legend" is only available when using point layers.
If you use a polygon with a Centroid Fill from polygon and use the Assistant on Size, no "Data Defined Size Legend" will be available.
It's an annoying limitation in QGIS IMHO but at least you know where your problem comes from.
For the polygons to points, 3 solutions:
- To convert polygons to point layers, you can use either "Point on surface" or "Centroids" algorithms in the Processing Toolbox. Main drawback = need to generate again and again the points from your polygons if there are changes.
- To get dynamic layer from your polygon point, you may use "QGIS virtual layers" with a recipe more less like below.
- Use a VRT (use XML based declarations to abstract other data sources) with the following
<SrcSQL dialect="SQLITE">SELECT *, st_pointonsurface(geometry) AS geometry1 FROM ne_50m_admin_0_countries</SrcSQL>
If you should choose between option 2 and 3, it's mainly about portability: virtual layers in QGIS = exclusive to QGIS whereas VRT ("Virtual Format") easy to move, portable with all solutions compatible with OGR/GDAL and it ecosystem.