Two stroke oil in the diesel is an old trick. It was mentioned in some manufacturers manuals also... 35 years ago. Did work with old prechamber diesels, but I would not try that with modern engine. Therefore manufacturers forbit doing that.
Basic idea is to lubricate the high pressure pump. For example during winter when the cold temp diesel is a bit dry, to help the pump lubrication. Also in super cold temps you were allowed to add gasoline/petrol to the diesel tank, to get the viscosity lower. Gasoline to lower the viscosity and 2 stroke oil to lubricate the pump, which would have otherwise suffered from the added gas... But you should not use those tricks with modern engines.
There are pump lubrication additives that may be used with modern engines and some manufacturers even recommend those... I do not know how much those have common ingredients with 2-stroke oil, but I would use the additives rather than 2-stroke oil.
And as we are talking about petrol engines, I would not put that stuff in the tank. I can't imagine modern fuel injectors handling 2-stroke oil very well.