Google's offers a bit more than "a search engine and Youtube." They also have Android, Maps, Drive, Chrome, Photos, Cloud, and hardware (Nest, Pixel, Chromebooks).
As far as Android, it came out in the Oracle trial that it has made less than $40 billion in profit during its entire existence. Which isn’t nothing, but seeing that Google has close to 80% market share (not including AOSP based Android phones in China) is not really impressive.
Mobile revenue is at this point bigger than desktop revenue, so Android and Chrome were really necessary projects for Google to not lose direct contact with users.
With youtube you're right, it took a lot of time to be slightly profitable, but I'm happy to pay for it monthly, as I'm learning a lot from youtube videos.
That changed recently because of an EU consent decree. At least in the EU. Now OEMs have to pay up to $40 per device.