I notice that when I type anything into google, google-related searches appear first. I know this is probably not what's happening, but it begs the question, could a search engine prioritize its own products and services legally?
Due to competition/antitrust laws it can be illegal, more so if the search engine is dominant in the market.
This has actually been realized in the EU where they fined Google €2.42 billion for abusing their market dominance and favouring their own Google Shopping service in search results. For further information, that fine has been specifically addressed on this site.
In the US, this has not yet come to such a dramatic penalty, but there have been investigations. The FTC has investigated similar search results manipulation among other antitrust issues, but ultimately decided not to file a lawsuit as the changes to the search algorithms "could be plausibly justified as innovations that improved Google’s product." Following this inaction, as of November 2017, the state of Missouri is also investigating Google on the same issue.
I'm not certain if manipulating search results on its own is illegal, but with market dominance (like what Google has), it certainly is.
Outside of monopoly. anti-trust and anti-competition laws, Google is not bound by law or regulation to rank search results in any way other than by their own prerogative. Google (and Yahoo and DuckDuckGo and other search engines) are private businesses and thus can present their search results any way they choose. They can show any search results they want to appear at the top, either automatically via an algorithm, or manually by editing search results. You agree to the Google Terms of Service and their methods to provide you search results when you use their service.
Now, to be clear, Google advertises that their search engine algorithm PageRank (Wikipedia) presents search results in order of the number of incoming links to those sites; that is one of the metrics they say is built into their search algorithm, and that metric automatically determines the value of a site and thus its higher or lower ranking in search results. By automating their search and disavowing any manual edits by people, Google claims to be impartial in their search and they say that gives much higher quality search results. And that algorithm may be one of the reasons Google has ~75% market share in search.
Google also presents advertisements at the top of SERPs (search engine results pages), so be sure you are not confusing those with the list of search results. Again, placing ads on SERPs is Google's prerogative; they are a private business.