It’s just a math solution/description I think the simplest/best one.

As you know when we apply a rotation in your example, it’s in local space.

So you can easily imagine that if you move first your object at the origin of z, then when you will rotate it here, it will be around z. Then after this rotation, if you reset your object at the preceeding location, “le tour est joué”.

Thus the best way to do it is by using an inverse matrice. It’s only maths.

The cost I think is,

firstly one matrix multplication for rotation

then

one inverse matrix caculation

plus one matrix multiplication to get the offset

then one matrix multiplication to get the new matrix of your object