The concept you are missing is UV texture coordinates.
Normally you would have to Unwrap your mesh and build a UV Map, but that is not always desirable or practical, and for most simple cases automatic texture coordinates will suffice.
If you plan to animate your object with deformations (rigging, armatures, shape keys etc.), or wish to export your model elsewhere (say a game engine or external application) you have to unwrap. Procedural or "generated" texture coordinates are created by the engine at render time and can't really be exported.
Otherwise, for that you have to use an Input > Texture Coordinates node, you can use either Generated texture coordinates output or the Object type coordinates.
Generated Coordinates will apply exactly 1x1 tiles of texture per object and stretch along with the object dimensions even if you change it's size (similar to the behavior you are currently getting in your images).
Object Coordinates will use the object's local coordinates for repeating your texture across the surface, exactly one tile per Blender unit (measured in object local coordinates), if the object grows in Edit Mode, more patterns tiles show up without stretching or distortion. If you scale it in Object Mode you will affect its local coordinates, and textures will stretch with it.
For both cases use the Vector > Vector Mapping node to adjust texture size or repetition of the pattern on top of the default value.
By default without any texture coordinate input in your node setup Blender falls back to UV Coordinates for any image based textures, and Generated for procedural textures, but the Vector Mapping node alone is inert on it's own and won't have any visible effect on textures (it may even make textures disappear). You will have to explicitly feed it some base coordinates to work with.
This is how the Vector Mapping node should work for all XYZ axis. Make sure your texture is set to Box projection method.
Have in mind that scaling the object in Object Mode without applying the scale will also stretch object space coordinates and thus textures along with it. To counter that you may use an Vector > Vector Transform node from Object to World to convert between coordinate systems.
The Vector Transform node converts between coordinate systems, if your object is scaled non uniformly in Z axis the it's texture space will also be stretched, in that case you need to convert the texture space from Local to global space so it transforms from Object Coordinates to World Coordinate system.
This will have other side effects like the texture being "pinned" to world coordinates and remain static in relation to scene, appearing to "slide across" moving objects like a projector.