Does your window face south or more north? That actually makes a real difference with cacti.
The problem you're describing is pretty much textbook light deficiency. Cacti stretch out lengthwise when they don't get enough light - they're basically "searching" for the light source, so to speak. It ends up looking like a thin, long stick instead of a compact plant. But here's the important thing that people often miss: the problem isn't just whether the window looks bright to you as a human. Cacti need direct, intense sunlight, not just a "bright room." A north-facing window or a spot where the sun doesn't hit directly won't cut it. Even if you think there's enough light because it seems bright to you.
Try this experiment: put your cactus somewhere with direct sunlight for a couple of weeks - ideally a south- or west-facing window. Just be careful if the plant was in the shade for a long time before - then acclimate it slowly, otherwise it can get sunburned. And yeah, watering regularly can also be a problem if you're watering it too much; cacti prefer it on the dry side. But the stretching definitely points to light first.