There are a few functions (ST_Force2D, ST_Force3D, ST_Force3D, ST_Force3DZ, ST_Force3DM, ST_Force4D) that not only modify the coordinates present in the geometry but (potentially) change the number or types of dimensions.
As noted in #544, ST_Transform can potentially do this, too (e.g., transforming from Lon/Lat to a geocentric CRS like 'EPSG:4978', where a 2D coordinate becomes 3D).
This could be handled with the CrsTransform (by including the input and output Dimensions and ensuring there is a hook available for all combinations of dimensions that might occur. For ST_Transform with PROJ specifically, we can query the number of axes of the input/output to at least detect changes (we probably have to assume that 3D is always XYZ because I'm not sure we have the information to guess otherwise).