I do have an addon that is supposed to handle this but it is not working for post replies. It does work for new threads.
The code in src/addons/.../XF/Service/Thread/Creator.php is:
<?php
namespace FS\AnonymousUser\XF\Service\Thread;
class Creator extends XFCP_Creator
{
protected function setUser(\XF\Entity\User $user)
{
parent::setUser($user);
if ($user->user_id == 0) {
$this->thread->username = "anonymous";
$this->post->username = "anonymous";
}
}
}