The book, Think and Grow Rich (Napoleon Hill) is the oldest book I know that fairly explicitly proposes the idea that your thoughts shape your reality. I believe there were other people in the 1870s-1930s also discussing this concept, so there may be something before his book.

A point worth considering, even for those who think this concept is "horseshit" (as another commenter says), is that the actions we take in life are usually dependent upon what we think and believe.

If you believe life sucks and everything is unfair, and that there is no possibility for upward mobility, then you will not make any serious effort to improve your situation.

The challenge is that it's very difficult to "believe" something before you've seen proof in your life. So these affirmation preachers are basically telling you to pretend to believe something, consistently, and to take steps as if you already believed. Somewhere along the way, the faith becomes an embedded belief. And judging by very devoted religious followers, someone with a strong belief can be unstoppable.

One common assumption is that people who are rich or successful are smarter than others. Occasionally that's true, but we can turn on cable TV to see ample evidence of very stupid people in positions of power and wealth. If you look at the one person I'm specifically thinking of, you will see a reality of a lifelong history of failures, but that individual seems to absolutely believe he is successful and powerful. And by outward appearances, he is.

I also like to consider the top performing artists or athletes. Anatomically and by athletic metrics, some of the top athletes should not be as successful as they are (relative to their peers). Sure, maybe their mind is sharper at times in some ways, but they also seem to share the belief that they can consistently do things which require such precision and environmental luck that others would call it unreasonable.

I wouldn't promote Elon Musk as a life role model, but he did believe something ridiculous and take enough steps to prove it was possible (building a successful new car company in a market already dominated by absolute giants). Sure, he had government funding, but we can look at plenty of tech startups who have received tons of investment and still failed. So it wasn't just luck.

There's another book that is not about success (unless you define success as "being happy in life"). How We Choose To Be Happy - Rick Foster and Greg Hicks. The authors of this book sought out people who were known to be unreasonably happy all the time in an attempt to understand how happiness could be chosen instead of just randomly experienced (when lucky).

Like the entrepreneur who believes they can build the unicorn despite the extreme odds, the person who chooses to be happy "simply" decides that a scenario or possibility already IS, before they have seen evidence. And because that shapes their behavior that follows, when they encounter other people, the other people recognize them as successful/driven/happy.

So we normal people, when we encounter one of the unusual(ly positive) people, do we want to be around them or do we want to avoid them? Angry people will be repeled, because angry people don't like to see others having success or joy. But the rest of us will be attracted to them - vaguely or specifically (perhaps to absorb some of that "luck" that they seem to have). Or the others have a similar mentality, so their movements and actions are somewhat similar and thus more likely to mesh with others like them. You see entrepreneurs with friends who are entrepreneurs. And you see angry conspiracy theorists with other angry conspiracy theorists. We're just naturally attracted to those we feel some common ground with, and many times we "accidentally" meet those people without specific intention or effort.

Whether there is some magic in the universe or not, it is clear that the way we think does impact our options in life. And since we (through some effort) get to choose what we think, why choose dead-end thought paths?