I don't have the major swing you have, from brilliant to horrible; but I understand the sentiment from earlier writing.
I suggest three things.
1) Treat yourself like a child, or at least like a student. A beginner. Write what you want, and when reviewing it, be critical but try to put your criticisms in phraseology you would use with a child learning to write. Figure out what the kid was trying to say, and why what they did say did not convey that accurately, or conveyed that embarrassingly, or whatever. If you think the writing is horrible; get past the emotion and into the analysis of exactly what is wrong with it.
You can try to fix it then, or just make notes in brackets [CHRIS: this metaphor doesn't land / sounds awkward / out of character / cliché / lacks conflict, too much puppetry / etc ]
2) Every day I read what I wrote the day before and do this, and edit it if I don't like it, until I like it again. If I can't get it right, I will scrap it and come up with a different scene. Fair warning: I am a discovery writer and probably throw out 25% of my writing for this reason.
3) On the longer scale, when I have finished a story, I will edit from the beginning, rewriting anything I dislike, and do that again. This is not an endless loop; I have finished books this way! I am about to begin my fourth pass at a finished story, and likely the last. It is important to be analytical doing this, and not change something (other than typos and grammar errors) just to make it different: Change it only if you know there is good reason to change it.
My most frequent reason, on the first and second pass, is murkiness in pronouns in scenes with several characters; the "she" that was clear to me when I was writing I realize was unclear with two females interacting in a scene; a habit I have been unable to break while writing the first draft.
Other frequent reasons for changes are lack of visualization, poor description of feelings, lack of conflict in conversations, lack of movement of characters. (A style choice, I like to keep my characters physically moving; even if they are stuck in a chair taking a test or reading a letter. If they are thinking, they do that while doing something else, the laundry or cooking dinner or mowing the lawn.)
In general, now that you know you don't like your first draft, don't move very far away from something before you edit it. It is very important to sleep between hammerings on a given section. The point of that is to flush the context from your short term memory, but don't go too many days before your first edit: You don't want to do so much other writing that the general purpose and intent of the scene has been forgotten.
For example, I remember I want to show that Alice is just beginning to fall in love with Bernie, I still want that, but my choices are not getting "love" across; it just seems like Alice is irritated with Bernie. I wanted the irritation to provide conflict in Alice, but I am clearly failing to portray her complete feeling, the scene needs something else, a saving grace for Bernie.
Edit to add: It belatedly occurs to me another issue I found causing this is failing to do what I have come to call writing with a methodical imagination. Specifically, when I write scenes, I methodically step through the senses and personalities of the people involved. What do they see, smell, physically feel (heat, cold, soreness, etc); what is the weather, what is their mood? What should the weather be, or the view, to support the scene? What can I do to create a clash or conflict? Is there anything they can physically be DOING while they talk? I do this to avoid "walls" of either conversation or exposition (info dumps), to create a scene that shows what I can, and tells what I want the reader to know but not dwell on (because showing takes longer than telling). For me, before I did this, my initial scenes were often sketches that felt incomplete, they did not accomplish the kind of immersion I felt reading other authors. I don't say you need a laundry list of every sense they have, I only pick two or three things to highlight. But knowing Alice is exhausted can influence her dialogue, her humor, and her choices. It may influence my word choices, too. The reader may not get "Alice is exhausted", but to me the scene feels better, has a more "unified" mood, if I keep things like that consistent.