C++ vs JavaScript?

As I see you are talking about https://en.m.wikipedia.org/wiki/Apache_Thrift
Made of Facebook for themselves. If you are interested to work in such big companies it’s good to know more about it, but do the first steps making an in house product first and then try something bigger on the server-side.

Why not written in HTML/CSS/JavaScript?

Because it’s obvious that any web page is a bunch of HTML/CSS/JavaScript/image files that is sent to the user’s browser. But the server which emits the page and the chunks of data (like the Google’s suggestions in its autocomplete feature) is a collection of applications (services) which work together for the client’s satisfaction. Imagine a busy Mc drive station, one relates with the client, another one is preparing the order and from time to time someone is cleaning the tables. Don’t forget to put the IT infrastructure too, in this picture.