as for the invincibility bug, it seems now like it might be more or less that when you dash at certain angles the invincibility won't activate for the full duration, but it flashes for a moment, and i am not good at tearing into the backbone of stuff, but if you are spawning different entities to make the trail expand that could be the reason.
well, if you deactivate invincibility when you stop touching enemy, then the game might mess up when touching two as once, and if you replace an entity with another, the invincibility might stop for a split second while it swaps out, and I can't tell exact angles, but ones that travel further through the trail, seem to have it happen more.