In real-life Japanese culture, many people do hope to get and attempt to get the attention of their love interest without ever voicing it or being direct, so this is not an anime/manga-specific trope but rather works of anime/manga are incorporating a very standard experience of elementary/jr. high/high schoolers in Japan past and through to the present. In other words, a particular anime did not start the meme, but rather some particular anime was simply the first to document the real-life occurrence of such moments. Shoujo manga magazines such as Ribon often feature color page spreads of advice and instructions on what hairstyles, fashion, and accessories could help you be noticed by the guy you like (I personally find this very dubious, having taught in 5th~6th grade in Japanese public schools... I'd be surprised if any of the boys are paying attention to how darling a girl's pencil case is and thereby thinking, "Oh, she's good at being cute. I like her now," but I digress), so from a young age, Japanese girls are encouraged in this practice of trying to attract a love interest without needing to confess her feelings to him directly (so that he will get interested in her before he realized she's interested in him).
Sempai (「先輩」) are upperclassmen in some sense to whom a Japanese person will always be kouhai (「後輩」, underclassmen) throughout their lives after graduation. There is no analogous system to the sempai/kouhai system in Western culture. Sempai are often older, but not always: more important than age is the person’s year in school or number of years in the shared bukkatsu (student club), company, etc. at the time that the kouhai enters said school, club, or company. This is true of both males and females, so we cannot say that a meme developed out of only girls in romance-focused series thinking secretly about their sempai; in shounen action anime, boys pine away for girls who they think might be out of their league too, whether older or the same age. For example, I'm a member of the manga student group at my university in Japan, and we all call each other by “-san.” Even though they're all younger than me (since I'm a grad student and they're undergrads), it would be totally inappropriate for me to start calling them in yobisute (that is, without a respectful name suffix) because they either 1) are my sempai in terms of number of years of membership in the club, or 2) they entered the club at the same time as me. If you enter university as a freshman and meet a sophomore who is your own age, he/she is automatically your sempai by virtue of being a grade ahead of you. Then, even if you have not seen your sempai in decades and you are now both middle-aged and working at different companies of equal repute, when you meet again he/she is still your superior to whom you must look up to, defer to, and serve; there is no evening-out of level in Japanese sempai/kouhai culture.
You write,
"it seems to be made up and not really existent in anime. . . . it doesn't seem like this particular line could have come from an anime."
If you are asking, which anime first featured this exact line of inner monologue where the seiyuu voices it, you might be correct in that the exact wording cannot be found; however, that would be hard to confirm. Since the sempai/kouhai relationship and the don't-confess-feelings-directly cultural element are both so standard in Japanese culture, it would be hard to pin-point and verify the earliest case of this moment documented in the anime medium, because you would need to be looking at the earliest anime TV films and series produced in the 60s that contain school settings, or possibly you would even need to check through the older propaganda films and shorts of the previous decades (which are difficult to get ahold of, even for anime scholars). That would entail investigating all the genres ranging from shounen sci-fi to shoujo sports series. Though I am not very familiar with 60s anime, I can say, at the least, that you can find this "notice me, senpai" moment, though not the exact phrasing, in many anime produced in the 70s, 80s, and 90s. Such an English phrase would be summarizing the moment that we do often see occur in anime.
See also my answer to this question:
. . . a major format of Japanese romance is to like someone who you are not friends with for a long time, and finally "confess" your feelings in a sudden love letter, on St. Valentine's Day, or on graduation day, in which the recipient must abruptly decide whether or not he/she has romantic interest in the other person -- who might not have been on the recipient's radar whatsoever. This can result in either being turned down on the spot ("I don't even know you"), a willingness to try to go on a couple dates ("Maybe I could get interested in you"), or the first-choice being the recipient is overjoyed ("I secretly pined away for you for years too!"). A lot of romantic feelings and sexual desire are never confessed, but some that are get rejected due to the format in which the potential couple does not get to know each other through friendship or casual dating before a major DTR (defining the relationship) event takes place, or reciprocal feelings are confessed right after the graduation ceremony and the respective parties part ways to go to different schools for high school or university, so the mutual interest doesn't lead anywhere.