Publish

Going back to your original example, have you tried just looping over the many_many relation and publishing? So on your Page you would have something like:

private static $many_many = [
    'Photos' => Image::class
];

public function onAfterWrite()
{
    parent::onAfterWrite();
    foreach ($this->Photos() as $photo) {
        if (!$photo->isPublished()) {
            $photo->publishSingle();
        }
    }
}