hello,
just a step to confirm @C4DS answer and if you look again at @r_gigante answer in this post it will make now fully sense.
regarding your code i will go like this just to be a bit shorter and easier if i want to add or remove a tag from the list.
    safeTagList = [5617, 5600, 1604]
    
    tags = node.GetTags()
    for tag in tags:
        if tag not in safeTagList: 
            tag.Remove()
Cheers
Manuel