How to set world quaternion of an object?

Hey everyone, I am trying to create a setWorldQuaternion method to set the world rotation of an object. Here is what I have so far, unfortunately this solution is not always working well on objects that do have parent rotations.

// update root matrix world before use
// scene.updateMatrixWorld();
// ...

THREE.Object3D.prototype.setWorldQuaternion = function(worldQua) {

	let rotMat = new THREE.Matrix4();
  let worldMat = this.matrixWorld.clone();

  rotMat.makeRotationFromQuaternion(worldQua);
  worldMat.premultiply( rotMat );

  let euler = new THREE.Euler().setFromRotationMatrix(worldMat);
  this.rotation.copy(euler);
}

I also tried to skip the use of Euler, but the solution below is affecting the scale of the object rather than its rotation (which is totally weird).

THREE.Object3D.prototype.setWorldQuaternion = function(worldQua) {

  let rotMat = new THREE.Matrix4();
  let worldMat = this.matrixWorld.clone();

  rotMat.makeRotationFromQuaternion(worldQua);
  worldMat.premultiply( rotMat );

  // Affecting the scale not the rotation O_O
  this.setRotationFromMatrix(worldMat);
}

Any idea what could go wrong with this code? Or maybe do you know a better way to do it?
Thanks!

Related : How to set child object rotation using quaternion in world coordinates using ThreeJS