datatype: finish layout corrections (#43306)
We still had some discrepancies between what the code thought could be
computed for a layout, and what we actually could compute layout for.
This hopefully makes those two computations now always give the same
answers (with the assistance of the layout cache).
Fixes #43303
(cherry picked from commit 30fe8cc2c19927cf4b4a5fe1ba1cbf4c2b7b7d84)