Earlier quoted context omitted.
And you would be violating the law.
Not necessarily. Plenty of rich peoples’ charities are incredibly inefficient at their stated purpose, good for their owners, and legal. Consider an imaginary tobacco tycoon’s charity that promotes cigarette use. It would be 100% legal.
"The organization must not be organized or operated for the benefit of private interests, and no part of a section 501(c)(3) organization's net earnings may inure to the benefit of any private shareholder or individual. If the organization engages in an excess benefit transaction with a person having substantial influence over the organization, an excise tax may be imposed on the person and any organization managers agreeing to the transaction."
A charity that promotes peace on earth may be beneficial to the donors to the charity... but if "optimized for my personal benefit" it is likely to be non-tax-exempt... but I suppose we could debate the exact words used and what they really mean in theory. I think in the above tobacco scenario, the IRS and courts would likely find that the tobacco promotion was merely advertising, and therefore subject to taxation.
https://www.irs.gov/charities-non-profits/charitable-organiz...