Does Kruskal-Wallis test have a non-parametric analogue that isn't sensitive to groups having different variability? I need a non-parametric test for my project (because I can't be sure that the distribution would always be normal), so I decided to use Kruskal-Wallis test.
But the problem is that Kruskal-Wallis test doesn't return the correct result if the groups doesn't have the same variability.
Does Kruskal-Wallis test has a non-parametric analogue that isn't sensitive to groups having different variability?

They are assumed to have the same shape and spread under the null. It's not necessarily required under the alternative. You don't know if the null is true so this is also not something you can "check" on the data -- it's an assumption.
While a pure location-shift alternative may be relatively easy to interpret, it's often not realistic. For example, in some situations spread is related to mean. In some situations shape is related to mean. Consider test scores, for example; as the average score gets very high, not only does the variance tend to reduce as the values squash up against the upper bound but they tend to become more (left) skew as well.
The Kruskal-Wallis can work perfectly sensibly on sequences of alternatives that have spread and shape smoothly changing as the location changes.
Note that the Kruskal-Wallis is unaltered by monotonic transformations of the response variable (it doesn't change the ranks). A pure-location shift alternative on one scale will NOT be pure location-shift after such a transformation, but the test behaves just as sensibly either way.

If you're in a situation where you can't assume exchangeability under the null, you won't satisfy the conditions under which a permutation test would be able to "permute" things.
You may still be able to do a (carefully chosen/constructed) bootstrap test (/confidence interval for some effect of interest). In large samples it should have close to the required properties.
