Preserving NBT tags on arrows
As far as I am aware, there is no way to directly preserve the tags in a useable way, I might be wrong though. But there is a workaround: You could apply a tag to the player (or check the inventory for the arrows with the tag, though that is a litte time consuming) and then let the players reapply the nbt-tags via /execute ... distance ... inGround:0b ...
So as soon as an arrow flies right next to the player this arrow gets the tag applied.
repeating Command Block:
/execute at @a[tag=ShootsLightning] run tag @e[type=minecraft:arrow, distance=0..3, nbt={inGround:0b}] add lightning
chain command block linked to the first one:
/execute at @e[tag=lightning, type=arrow, nbt={inGround:1b}] run summon minecraft:lightning ~ ~ ~
another repeating command block:
/kill @e[tag=lightning, type=arrow, nbt={inGround:1b}]
There are some problems with this. For example: Arrows which aren't shot by the player but fly near him will get the tag applied too.