Express translation and rotation with respect to another coordinate system

I have a model with a starting transformation.

I am using pivot controls to allow the user to move the model.

The starting transformation * user transformation is applied to the pivot control and the model is aligned the pivot control.

I also have a display of the user transformation position (offset) and rotation.

I want the values in that display to be the user transformation position and rotation with respect to the total transformation applied to the pivot controls (starting transformation * user transformtion).

For example, if the user rotates about the z axis and then translates along the x axis, I want the display to only have non-zero values in the z-rotation and x-translation spaces.

I tried the following, but it does not work as intended.

    const setValues = (userTransformation?: number[]) => {
        const totalTransformationMatrix = new Matrix4();
        if (!!startingTransformation) {
            totalTransformationMatrix.elements = [...startingTransformation];

        const userTransformationMatrix = new Matrix4();
        userTransformationMatrix.elements = [...userTransformation];

        const xUser = new Vector3();
        const yUser = new Vector3();
        const zUser = new Vector3();
        userTransformationMatrix.extractBasis(xUser, yUser, zUser);
        const userBasisMatrix = new Matrix4().makeBasis(xUser, yUser, zUser);

        const xTot = new Vector3();
        const yTot = new Vector3();
        const zTot = new Vector3();
        totalTransformationMatrix.extractBasis(xTot, yTot, zTot);
        const totalBasisMatrix = new Matrix4().makeBasis(xTot, yTot, zTot);

        const conversionMatrix = userBasisMatrix.clone().invert().multiply(totalBasisMatrix);
        const convertedUserTransformationMatrix = userTransformationMatrix

        const translation = new Vector3().setFromMatrixPosition(convertedUserTransformationMatrix);
        const rotation = new Euler().setFromRotationMatrix(
            new Matrix4().extractRotation(convertedUserTransformationMatrix),

        const conversion = 180 / Math.PI;
        rotation.x = rotation.x * conversion;
        rotation.y = rotation.y * conversion;
        rotation.z = rotation.z * conversion;

User basis should be starting basis. And the conversion should be applied to the position. Then it works.