How does Google know what apps I've installed if I login to gmail via browser? I logged into gmail using Microsoft Edge and Google immediately sent an email saying that my device doesn't have the latest Google apps.

How did Google come to know which apps I have installed and if they are latest or an older version? It would make sense if i was using the gmail app. But in my case, I logged in using the browser.

Or is it just a generic notification because I am accessing gmail via browser and Google assumes that I don't have the latest apps?
The login to Gmail is the very same you use for Play Store – so in fact Google knows it's you. The browser sends a user-agent string, by default identifying your device (brand and model). The history of your activities in Google Play Store tell which apps you've installed in what versions on this device.

So yes, that would be an easy thing to do for Google. I cannot say if that's really happening (or if your guess of not using the native app triggering such message is what's done) – but it's technically possible.