Headers do two things: provide an array of electrical connections, and mechanical alignment. Depending on how many pins, and how many are arranged on the board(s) and where, rotational alignment may be weaker, but location is always dictated by the pin and socket.
Strength is determined by header type and mounting; SMT headers like shown, you don't want much stress on, as the solder joints, or pads themselves (foil-laminate bond), aren't especially strong. SMT connectors are best for low stress, low cycling connectors (e.g. internal, user-inaccessible), and providing vibration damping and strain relief is recommended.
You might consider separating these functions, by using a spring or pogo-pin header, and separate mechanical alignment. The electrical contacts can then be simplified, perhaps permitting a lower profile.
Headers without alignment include spring contact arrays like TE Connectivity AMP Connectors 2199055-2, KYOCERA AVX 009188006020062, or battery connectors like KYOCERA AVX 009155005002016; pogo headers like Preci-Dip 811 (or Mill-Max), and targets like Preci-Dip 800, Mill-Max 319, etc., or plain PCB pads (preferably hard gold plating; ENIG has very little cycle life, let alone against vibration).
There are also single pogo pins and targets such as here: Contacts, Spring Loaded (Pogo Pins), and Pressure | DigiKey; effectively, you might craft your own bespoke connector by arranging pins in ideal locations, rather than having to collect them into headers.
Locating pins and mounting screws/standoffs transmit between-PCB stress and vibration, addressing one of the drawbacks of using headers alone. (See also: board edge guides to maintain orientation, especially for right-angle mounting with headers, edge connectors, in card cages, etc.)
Alignment pins can be a part of the enclosure, sliding or press fit into a PCB (any standard mechanical parts apply: hard pins, roll pins, etc.), or press-in or swaged hardware. For the latter, see PEM locating pins for example. You may find press-in or solder nuts, studs, standoffs, etc. useful for various mechanical assemblies. Examples: Keystone 24939, Würth Elektronik 9774030360R, PEM SMT types, etc.