Apparently there's a bug, that when you get kicked while you're in a form-ui, you won't see the actual kick screen, instead you stay in the ui until you manually close it. Well, this plugin forces a close of the player's current form, so they actually get kicked.
If you want to add this to your own plugin, just do this to force a form-ui close:
$player->getNetworkSession()->sendDataPacket(ChangeDimensionPacket::create(
DimensionIds::NETHER,
Vector3::zero(),
false
));