We don't know if the Beagle bunch would even have been bound by the PD.
In TNG, the PD appears to only tie the hands of Starfleet field commanders; civilians have a free run with societies, primitive and advanced alike. TOS doesn't really contradict this. Perhaps the purpose of the PD is not actually to protect the virginity of primitive cultures, but to keep Starfleet field commanders from elevating themselves to gods?
That is, a Galactic High Commissioner could interfere in the affairs of foreign civilizations, because he's merely the unarmed and unthreatening representative of the democratically operating government of the UFP. And through him, said government can order its military commanders to execute the dermocratically decided policy of interference. But without Ferris on board, Kirk would not have the permission to interfere at Eminiar, because that gives way too much power to the guy who's in direct control of extinction-level weapons. Without direct Starfleet orders, he could not practice gunboat diplomacy on the Melkots, either.
When Kirk does interfere, it's in reaction to unpredictable events, in situations where it's too late to request the exalted presence of a High Commissioner or even to ask the HQ for clearance to bombard the natives. In the 23rd century, he may have had the leeway to interfere in self-defense; in the 24th, even this leeway may have been taken away from starship captains, because it poses too great a danger to the chain of command and to the very structure of the UFP. Even Kirk is expected to give his life if that best serves the UFP, rather than pull stunts to save his own ass but betray his government in the process.
Timo Saloniemi