ParserOutput::addImage() current takes a string dbkey. For consistency with the other methods in ParserOutput (see T296023) this should take a LinkTarget|LazyLinkTarget instead.
This also means that this code in ::addImage($name,...):
$this->mImages[$name] = 1;
should be changed to store a list of LazyLinkTargets instead, and they can be deduplicated "at the last minute" when the LazyLinkTargets are resolved in a batch.