Genre script fails when using Wikidata Genre plugin and a recording without Release ID

I have been noticing that a script that I use to redirect ‘genre’, sometimes did not function as expected.
While it is designed not to write the ‘genre’ tag and leave it untouched, it sometimes failed to do that and still wrote the ‘genre’ tag.
It took me quite a while to figure out what was happening and how to replicate it, but I think I finally figured out when this happens:

This is the script:

$set(genretemp,$get(genre))
$unset(genre)

So it should write a tag named ‘genretemp’, and never write the ‘genre’ tag.
But it sometimes fails and will write ‘genre’ just the same:

I have now discovered that it happens when using the Wikidata Genre plugin and loading a track that does not have a MusicBrainz Release ID.

If the track has a Release ID, the script will perform as desired:

I am wondering if this could be considered to be a bug?
(either with Picard or with the plugin?)