Kirchhoff’s Voltage Law validity in short circuited circuit

Imagine a circuit with a battery and a resistor. Now I connect a resistance-less wire in parallel with the resistor.

There will be a potential difference between the two ends of resistor, so current will be generated. But current prefers least resistance path so all of it will prefer the path that is in parallel with resistance.

So current through resistor is…zero?

But resistor is the thing because of which current is produced in the first place.

What exactly is going on here?

Also now if we apply KVL we can only take the potential difference across the battery and we equate it to zero, but we know it’s not zero

There will be a potential difference between the two ends of resistor, so current will be generated

No there won't be any potential difference across the ends of the resistor. Because you have connected an ideal (resistance-less) wire in parallel to it, both it's ends are at the same potential, so the potential difference across the ends of the resistor is zero. Hence, as you have stated, the current through the resistor is zero.

Also now if we apply KVL we can only take the potential difference across the battery and we equate it to zero, but we know it’s not zero

The loop rule is not broken here. We have to use the rule with the limit that $$R_{\text{wire}} \rightarrow 0$$. In that case, all of the voltage appears across the "ideal" wire: $$\sum \Delta V = 0 \rightarrow \varepsilon - i(R_{\text{wire}}) = 0$$ $$i = \frac{\varepsilon}{R_{\text{wire}}} \rightarrow \infty$$ which is what usually happens in a short circuit ; the current becomes very large.

Hope this helps.

Also now if we apply KVL we can only take the potential difference across the battery and we equate it to zero, but we know it’s not zero

Not all mathematical systems of equations have a solution. In this case you have two equations $$v=V$$ and $$v=0$$ and there is no $$v$$ which satisfies both equations. It doesn't specifically have anything to do with KVL, it is just a logically impossible scenario.

Now, no-resistance wires are physically possible, and batteries are physically possible, and it is physically possible to short circuit a battery with a no-resistance wire. So what is impossible is using the above equations to describe such a scenario. In particular, either the current will be so large that all of the voltage will drop across the internal resistance or the current will be so large that the wire will stop superconducting. Either way the scenario will no longer be described by both $$v=V$$ and $$v=0$$, at most one of those two equations will be a valid description of the physical system.