IMHO one method to prevent atmospheric loss is to put a roof on the atmosphere. That would prevent both loss due to the solar wind in the absence of a magnetosphere and loss due to air molecules and ions with speeds higher than the Martian escape velocity.
Percival Lowell believed that Mars was gradually loosing water and drying up due to loss of atmospheric light gases. And he believed the Martians built a vast canal system to manage their remaining water resources. But apparently Lowell never thought about more long term solutions to the problem.
Lowell published three books with his theories: Mars (1895), Mars and Its Canals (1906), and Mars As the Abode of Life (1908). At that time interplanetary space was known to be a vacuum.
So 19th century fictional space ships would have to be airtight so the air wouldn't leak out and the passengers die. Some examples include:
From The Earth To the Moon (1865) Jules Verne.
Across the Zodiac (1880) Percy Gregg.
A Journey to Other Worlds (1894) J.J.Astor.
The War of the Worlds (1897) H.G. Wells.
Auf Zewi Planeten (1897) Kurd Laswitz.
Edison's Conquest of Mars (1898) Garrett P. Serviss.
So Lowell could have read about artificial airtight enclosures with breathable atmosphere inside and deadly vacuum outside, and could have extrapolated the idea to hypothetical Martians preventing loss of the Martian atmosphere with giant artificial airtight enclosures to keep the breathable air inside. Or even eventually uniting them into a single giant worldwide artificial airtight enclosure to keep the entire Martian atmosphere inside. But apparently Lowell never suggested that could a long term strategy for the Martians.
So hypothetical future Human terraformers of Mars might not release gases into the wild and unconfined Martian atmosphere and instead use imported steel from iron-nickel asteroids to build large airtight buildings in the Hellas Basin and fill them with gases derived from asteroids with high contents of light elements. They would expand the buildings upwards and sideways to eventually fill the Hellas Basin and spread outwards to eventually cover all of Mars.
Or possibly the roof(s) could be supported by the air pressure differential in the lesser gravity of Mars. If the Martian atmospheric roof is far enough above the ground and the roofs of buildings, there may be space for aircraft to travel from place to place. Presumably pilots would be instructed to never get too near to the roof and risk making a hole in it, and if necessary to deliberately crash their vehicles rather than risk making a hole in the roof.
A breathable Martian atmosphere confined by an airtight roof above it could have a much smaller total volume and mass than a wild and unconfined breathable Martian atmosphere. And the original thin and almost useless Martian atmosphere would remain above the roof.
The thin original Martian atmosphere is still thick enough to decelerate and/or burn up meteors. in fact, because of the lower surface gravity of Mars squashing down its atmosphere much less than that of Earth, Mars has air thick enough to heat up and decelerate meteors at a higher altitude that Earth does.
So an original and unmodified Martian atmosphere above the hypothetical Martian Roof would be thick enough to stop the common grains of dust and pebbles. And no atmosphere possible on a terrestrial planet, not the atmosphere of Earth, nor the atmosphere of Titan, nor even the atmosphere of Venus, would be thick enough to stop a Chicxulub or Vredefort sized object from impacting and causing an extinction event.
If the hypothetical Martian Roof is transparent it could have coatings to cut down the intensity of ultra violent ultraviolet radiation to levels comparable to those at Earth's surface, or whatever level seems desirable. Thus those coatings on the hypothetical Martian Roof could serve the function of the ozone layer in Earth's atmosphere.
Since the Martian colonists would have to live in airtight enclosed habitats for centuries or millennia while terraforming Mars, they would lose the idea that a proper planet is one that is habitable outdoors, and become used to living in places that are only habitable indoors. Thus the idea of making all Mars an indoor world would be acceptable to them if it reduced the total terraforming time by a few centuries or millennia.
Putting a roof over the entire surface of Mars would be an incredibly vast project, but terraforming Mars is itself an incredibly vast project. But both projects would require finite and calculable amounts of matter and energy and thus would be theoretically possible.