The State of Israel came from the end of the British Mandate and the idea of a UN resolution. In 1947 the UN was, effectively, the Allies, so while not 100% accurate it's handy shorthand. I admit it skips a year or so of civil war.
The treaty I referenced was the 1949 Armistice agreements which divided East and West Jerusalem. Had Jordan stayed out of the 6 Day War in 1967, they would still have control of East Jerusalem, Their annexation would probably be recognized by more than just the UK by now, and we wouldn't be having this conversation. They didn't, They lost, and Israel annexed the rest of the city.
ETA: It's entertaining to me that De Selby has drawn me into this particular argument. I am not a fan of Israel. I don't like their government, the way they treat citizens, or the way they manipulate public sentiment in what is a complicated, very long running feud. That said, they are a sovereign nation and get to pick their capital, and they picked Jerusalem.