There’s a bunch of things involved in mail.
Rate limits in Virtualmin are provided by a policy server (usually milter-greylist, I think, I don’t remember details, and it varies by OS and version), which is not involved in local sending. That’s a configuration choice, you can put it in the path for local mail delivery, too. Trickier to configure, though, as it then ends up applying to incoming mail, too.
PHPMail (any scripts, not just PHP) is a whole other issue. Unless you firewall outgoing port 25 traffic, any user that can cause scripts to be run (via any mechanism, including PHP) can send email with or without the local MTA being involved…sending mail is trivial. You can literally do it with telnet or nc in a few lines of bash. This is another tricky issue that causes a lot of surprise complexity. It is possible to block traffic based on user in iptables/nftables, but we don’t try to do that, because we’re trying to not be inundated with questions about why mail doesn’t work. But, we probably should revisit that problem at some point.
We’ve historically not recommended using Virtualmin for bulk hosting or free hosting or situations where your users are completely untrusted and likely to abuse the system. But, insecure web apps do get abused sometimes, through no fault of the user (well, not no fault, but not an inexcusable fault, since securing web apps is a hard problem), so it probably would be good to provide tools to lock down those sorts of ways for spam to get out.
We’ve been discussing a total refactor of the mail stack for some time. It’s on the agenda, but we’re all mostly volunteering here, we all have other jobs, so it hasn’t bubbled to the top yet. It will, some day. If you have strong feelings about it and technical expertise necessary to work on it, we always welcome contributions. (The vague direction I see: Sieve for filtering/forwarding instead of Procmail, maybe a switch to Cyrus instead of Dovecot for JMAP support, a better spam/AV stack maybe built on rspamd or another policy server, removal of the hodgepodge of current policy servers for greylisting, rate limiting, DKIM, etc. replacing with a single tool for all of them…rspamd, probably.)
But, a firewall that blocks outgoing port 25 except for the Postfix user would solve one of your problems, and that’s simple. No rate limited for internal mail I think is also a one line config change, maybe? But maybe has side effects. I’ve never done it though, so it’d need some research.