Translations vary on whether Solomon wrote this himself of took it into his collection of wisdom literature. Either way, it reflects the kind of broad moral insight he had. We can be sure this wasn’t written for the annual pilgrimage. However, it was included later because, without such moral wisdom, there would be no city and temple to which they should return every year. This psalm is loaded with Ancient Near Eastern symbolism; don’t get lost in the apparent literal meaning.
God is the foundation and the blueprint of a life worth living, for both individuals and the nation as a whole. Don’t start any projects without first insuring that God is involved. And once you have built, you cannot keep it without God’s continued favor. You must choose a course that God has laid out in His revelation, or everything you do is wasted effort.
Cease striving on your own power; work smarter, not harder. Internal peace is a gift from God. Good responsible stewardship means taking care of your own sanity and health as part of the shared resources of your covenant community. There is nothing noble about a pointless sacrifice to lesser things.
But if you hear and obey the Word of God, then it would be just like a man who fathers many children while he is still young. Now that’s a job worth some extra effort, worth a little struggle early on in your life. The spawn of obedience will go far, stopping threats from a distance like archery in battle. You can never have too many arrows of that sort. They will become men before you are old, established and well known in the community. Then when you do grow old, these worthy sons can present a strong argument in your favor when opponents try to bring judgment against you.
The implication is that you’ll die in peace because you lived in shalom.