If there is any research on Goal Based Programming (GBP)? The more I think about programming and optimization, the more I think "why not just specify a goal and have the program figure out the optimal solution to it".

I am familiar with basic "optimization problems" such as finding the best fit line to a curve, or gradient descent sorts of things. What I'm talking about is way more complicated than that.

What I'm imagining is to say something like "An HTTPS server exists", and for the system to figure out how to build one. Obviously given just that info, it's not enough. It would require human-level training in programming and understanding concepts and everything.

But my question is, what could you do to build a system to support such a "goal statement"? What would the key parts be?

It seems at first, the simplest goal is "Action x is performed". This is required to change the current world into the desired (goal) world. For example, "Add" is performed on 1 and 2 is a goal stating that the "add" function is applied to the two arguments. It seems that from this foundation, you can build up higher and higher levels of abstraction to the point where you could then say "An HTTPS server exists". But this HTTPS server is a structure, not an action. So you need some way to have some intermediate goals that transcribe goals into (not actions, but) structures. Perhaps, The result of x operation exists is a simple transformation between the two.

But then I'm stuck haha. What do the goals look like in the intermediate realm? Has anyone done any research into this area? Searching doesn't yield much, though it brings up a book Goal programming and extensions which I might have to purchase.
Yes.  The research area is known as program synthesis.  You can find hundreds or thousands of papers on the subject.  (You might also be interested in declarative programming.)

What you're describing is way beyond the state of the art.  It'd be really cool if we could do something like that -- but we're a long long way away from knowing how to build that.