Markets rallied this year as inflation moderated and job growth remains strong, feeding investors’ hope that the economy can stick the elusive soft landing.