Google, who operate Firebase, enable and encourage Firebase customers to partake in advertising, e.g., by linking their Firebase account to an ads account.
https://support.google.com/google-ads/answer/6333536?hl=en
https://support.google.com/google-ads/answer/6333536?hl=en
Linking Firebase to Ads requires conscious action on behalf of the developer, while the former only requires using any Firebase product.
Also, Google is in the online ads business, so I don't think it's surprising that they provide docs that show how to use Firebase data to target ads. That said, it's not the default, so it's not as shady as you're making it sound.