Self-path intersection

So I’m trying to figure out a way of finding the intersection of a path that loops around on itself. The best way to hold the path of an object would just keep an array of points to a certain length as it moves.

I’m looking to achieve something similar to the looping/collecting in NiGHTs, you can see what I mean in this video.

But I’m not sure how to tell whether the path as looped over itself or not, I can do it using calculus lol, but that would be way too slow and impractical. Even if I check each segment (point to point) for bisection, it seems like a lot of unneeded checking. I also, have no idea how to quickly find what’s inside of the “loop,” when the intersection is found. Anyone have any ideas or links that would help me out?