Rivets came into existence when denim designers discovered that jeans seams were not strong enough to support the weight of the tools kept in the pockets by workers and miners who they were originally designed for as it always come out loose. The rivets were invented with a keen goal of holding the seams tight in their place.
These tiny pockets were meant for Cowboys to put their pocket watches in, so as to get them out easily when needed!
Front pockets and side seam
Ergonomically speaking, the pockets on the sides are more convenient while sitting or standing. However, prior to the middle of the 20th century, the weapons (sword or handgun) were more important than anything you hold in your pockets. Hence pockets were made in the front and back, to make carrying of weapons on both sides easier. To further facilitate that, seams were made on the side!