I'm going to discuss the Weimar period with regard to the OP's question.
The Weimar Republic began circumventing the military clause of the Versailles treaty before the ink was even dry on its signatures.
The three notable examples of this are the creation of the Freikorps, militias composed of ex-soldiers whom the German military had various degrees of controls over. Since they were not technically part of the German military, they didn't count towards the 100,000 men limit. They were used to put down both leftist revolutions at home and to fight against Poland in various border conflicts which ultimately settled the interwar German-Polish border.
The second example is the secret German-Soviet cooperation in the aftermath of the Treaty of Rapallo with the USSR in the 1920s allowed the Germans to setup military training facilities and programs inside the Soviet Union, away from the eyes of western powers. There, the Germans were able to setup aircraft factories, tank schools, chemical warfare facilities etc which allowed interwar Germany to possess access to technology and equipment they were officially banned from having.
The last example was the preservation of the German general staff (central planning apparatus of the German military), originally banned by the Versailles treaty, the Reichswher hid a core of the general staff under the auspices of a Human resources department.
While it was Hitler which began to openly rearm Germany, the Weimar Republic did a lot to lay the groundwork for Nazi rearmament of the 1930s.
This is admittedly a pretty incomplete answer and more complete answer would go up to the Nazi period and why the Nazis essentially started to rearm sooner and faster than the western powers did and thus had a window of opportunity in which the parity of forces favored Germany. The fact that interwar Germany chose much better doctrines than the British and French did and that to a large extent the German military -wasn't- all that strong in first phase of the war. Wages of destruction by Adam Tooze is a really good read on German rearmament.
The German military was never non-existent, not even at its lowest. While the Versailles treaty limited the German army to 100 000 men and no reserves, the Germans, while adhering to the letter of the treaty most of the time, never adhered to the spirit of it.
Various 'military police', 'freikorps', 'shooters' clubs' and other militias and paramilitary organisations as well as political organisations militias were in many cases reserves, many times made up of veterans from ww1 partaking in part-time military training.
The so-called 'Schwarzer Reichswehr' (Black Army) hid SMGs, machine-guns, heavy artillery, ammunition and supplies and paid for it by illegal exports of arms to Germany's beighnours. For example, the Germans exported 10 LK-I tanks to Sweden, where they served as Strv m/21 as boiler plate and Agricultural machinery.
Hans von Seeckt, commander of the German army also prepared it for a rapid expansion by making sure every man was trained for a rank or two above him. Senior officers could become generals, officers could become senior officers, NCOs could become officers and soldiers NCOs, leaving Germany a core which could rapidly be fleshed out with recruits as soldiers or men from the various militias and other paramilitary organisations.
The Germans were banned submarines, SMGs, heavy artillery, AA weapons and many other weapons - they solved the problem by buying whole or shares in various arms companies such as the Swedish Landsverk and Bofors, the Swiss Oerlikon, SIG and Solothurn, the Dutch HiH Siderius and various submarine yards. German engineers and technicians continued their work there and designed arms that would be produced in Germany after the nazis rejected the Versailles treaty and re-introduced conscription in 1935.
The Germans gave a lot of the arms designed in Germany and in other countries the model year 1918 to fool allied inspectors that they were designed and produced before the Versailles treaty went into effect. Thus you see arms like the 10,5 leFH18, 15 sFH18, 7,5 leIG18, 8,8 Flak18, 7,92mm Kar 98k, 7,92mm MG15 and so on. You also see some extreme similarities between German arms and some of other countries. The 8,8 Flak18 and the Swedish 7,5 Lvkan m/30 are almost exactly the same weapons.
The Germans also entered a secret agreement with the Soviets, sending Germans to train with tanks and planes in Kazan in Exchange for technical know-how for the Soviets.
Ernst Udet also visited Sweden in 1934 to study Swedish tests with dive bombing with the B 4 Hawker Hart, which led to a technical cooperation on a bombing sight for dive bombing, which was used both by Germany and Sweden and Udet becoming a strong proponent of dive bombing, which would lead to the development of the famous Ju 87 'Stuka'.
Germany also sponsored and encouraged air clubs to have a cadre of both powered and unpowered flight capable pilots once they wanted to re-establish and air force.
Thus, when the nazis re-introduced conscription in 1935, they had;
A strong core of the regular army of 100 000 officers and NCOs a well as the various militias and paramilitary organisations to build on.
Large chaches of hidden arms.
Technical designs and experienced engineers for arms production to call home from various companies in neutral countries.
Tehnical expertise on air and tank combat learned with the Soviets in Kazan.
A core of pilots from the flight clubs.
Then the nazis spend Germany into the ground, bankrupting the nation in a 4-year mad armaments program. Note that they could and did absorb all the equipment of the Austrian and Czechoslovak armies. Even after siezing the Austrian and Czechoslovak equipment and gold reserves, the German army was smaller than the French one in 1939, and banked pretty hard on their Westwall keeping the French out while they took care of Poland.
From an earlier post of mine on the German economy before the war:
Hjalmar Schacht, the Chairman of the German Central bank introduced the MEFO, a currency with which the state could pay companies for contracts and deliveries, that could only be used to pay taxes and fees to the state. Thus the Germans could in essence print a lot of money without it entering circulation and creating inflation.
Still, the reichsmark was in theory pegged to gold, but no exchange to gold was possible, and the value was set so high that no-one outside Germany accepted it, forcing the Germans to pay for vital imports - such as iron ore, led and copper from Sweden, tungsten from Spain and Portugal, oil from Romania, nickel from Finland, chrome (essential for armour) from Turkey and so on - with gold, hard currency or industrial produce.
The nazis kept a very strict price and wage regulation and set interest rates high to ensure a low inflation, despite printing a lot of reichsmark (not just MEFOs).
Weimar Germany had kept, expecting a British blockade in case of a new conflict, a law that forced all factories to keep 6-18 months worth of raw materials stockpiled, a law that was abolished by the nazis and allowed companies to burn through this reserve, granting a temporary boost.
The nazis burned through the German gold and currency reserve and all assets seized from Jews and other "undesirables" and had defaulted on all foreign loans by 1939. During 1936, the German gold reserve fell from $33 133 000 to $26 707 000, despite all these schemes and siezed assets.
The Germans seized the Austrian gold reserve in March 1938, yet at the end of 1938, Hjalmar Schacht reported to Hitler that all currency and gold reserves had been exhausted, that 6 billion MEFO bills could not be honoured by the government and that re-armament would have to be cut by 20-30%, or Germany was bankrupt. Hitler promptly sacked Schacht in Januari 1939.
The Czechoslovak gold reserve was siezed in 1939, and parts were delivered to the nazis from the Bank of England in April-September 1939. The nazis also took over the Free State of Danzig's gold reserve in September 1939.
The Germans continued to expand their army 1939-1940 and then again until Operation Barbarossa in 1941, when it peaked in size.