Deeper RF magic. That trace is a Meandered Planar Inverted-F Antenna, see
Wikipedia for more information. I won't pretend to know all the details about the dark magic that is RF, but from what I
gather, the bit from the feedpoint to the ground acts like a resonator which improves the functionality of the antenna.
Now, there's the implicit question why your thing doesn't connect unless you cut the ground loop... and I can only guess there. The little ground-less thing still works as a whip antenna, so breaking the ground still makes the PIFA into a working antenna, but I'd expect it to work less well rather than better. Your module doesn't seem to be an official Espressif one, so potentially whoever made it, messed up; the dimensions of the trace as well as the type of PCB material are critically important for an antenna. Could also be that the devboard (rather than the module) is faulty: the antenna is influenced by the things around it as well, so something like having a ground plane directly under it might affect its impedance so it fails in normal use, but works if you convert it to a whip antenna like you did.