Make a class that extends pocketmine\entity\projectile\Arrow, override Arrow::canCollideWith() with whatever your check is, and register the custom arrow class the same way pocketmine register the original class
The class name does not matter, as long as you register it the same way pocketmine registers the original class PHP: Entity::registerEntity(Arrow::class, false, ['Arrow', 'minecraft:arrow']); the bow (and anything that spawn arrows) will automatically use your class when it shoots an arrow.