src/TaggableBehavior.php
public function beforeDelete()
    {
        // store tag ids list
        $this->_tagsForDelete = [];
        $relation = $this->owner->getRelation('tagsList', false);
        if ($relation instanceof ActiveQuery) {
            $this->_tagsForDelete = (new Query())
                ->select(current($relation->link))
                ->from($relation->via->from[0])
                ->where([key($relation->via->link) => $this->owner->getPrimaryKey()])
                ->column($this->owner->getDb());
        }
    }
public function beforeDelete()
    {
        // store tag ids list
        $this->_tagsForDelete = [];
        $relation = $this->owner->getRelation('tagsList', false);
        if ($relation instanceof ActiveQuery) {
            $this->_tagsForDelete = (new Query())
                ->select(current($relation->link))
                ->from($relation->via->from[0])
                ->where([key($relation->via->link) => $this->owner->getPrimaryKey()])
                ->column($this->owner->getDb());
        }
    }
Before delete event