Non-commercial loans aren’t loans##loans
A company can legitimately lend shareholders money if it does so on commercial terms - over a realistic time frame at commercial interest and receives regular repayment of at least the interest and will ultimately receive the principal. The company will need to pay tax on its interest income and that interest may or may not be tax deductible for the individual. It it does all that, the advance is a loan; if it doesn’t, it isn’t.
Tax law treats loans that aren’t loans as what they are - dividends or salary and taxes you accordingly. And fines you for tax evasion.