Most of the time, it's because writers and designers just don't know how to create a female character. They aren't friends with women, they don't work with women, they don't speak extensively with women, and their most regular exposure to women and femininity comes from media written by other men designed for men to consume. This happens a lot in male-dominated societies. When the only women you speak to extensively are the ones you're sleeping with, you become unable to portray or even understand women in any other context beyond your attraction to them.
So when writers start laying out a story, they automatically write characters as male. They don't even think about it. When the story needs a best friend or a manager or a shopkeeper or police officer, they are automatically male whether the author is consciously creating them as such or not. This is how entire stories get written without a single female character (Lawrence of Arabia, for example, features no speaking female characters whatsoever). But most writers are conscious enough to realize they haven't written any women, so they add
one. Because the only way they understand female characters is in relation to the male ones they've already created, the female character usually becomes an accessory. A wife, a daughter, a love interest, etc. This is why, famously, most women who have won Oscars win them for playing wives. This is also why women often don't talk to each other or share scenes with each other because they're only there for male characters to talk to. This is how their roles are written.
And since the first thing male writers usually think about women is how hot they may or may not be, it comes through in the writing almost immediately. There is a funny, and also sad,
Vogue article about this phenomenon here that mostly
focuses on an entire Twitter dedicated to female character intros in scripts written by men. Here is an example:
Even men capable of writing terrific, complex, and interesting characters fall into this trap of writing shitty women because they so strongly associate them with sex that they don't know any other way to introduce them.
When it comes to video games, which are often designed independently from a legitimately ambitious story, characters are designed with even less connective tissue. The
player becomes the stand-in for a male main character, even when a male main character exists, so the designers write roles for how they relate to an assumed male player. This is why they are disproportionately young girls who need protecting or sex objects for lusting over (or both).
Truthfully, female character designs and legitimate female characterizations have gotten way better over the last few years. But the problems they've always faced, in every medium, still persist. There are sexualized female characters that are still good and interesting leads (Bayonetta, 2B) and there is absolutely a place for characters like this. The issue is proportion, or more accurately disproportion, and how frequently overly objectified female are there specifically to ellicit erections instead of emotions.