How does google maps know that I've taken pictures?
As evident from the screenshot of the Google Maps settings, you've granted the app access to all your photos. So there is nothing which stops Maps from searching geolocations of photos recently taken and make appropriate recommendations.
Also, this thread here suggests that

Google Maps suggest automatically to upload photos to places you visited.
This option could be modified here:
Open Google Maps then go to menu &gt; settings &gt; notifications &gt; your contributions &gt; adding your photos, see suggestions for photos to post (DISABLE THIS BOTTON).

Those who have this or geolocation disabled mayn't see the photos access prompt or access settings..
The best I can speculate is: App has geolocation or location history turned on. When you agree to share/upload photos for improving the service, it asks for photos access and it's granted. Now whenever you return from some place to a previously significant place, photos can be checked against for location for recommendations.
As per the comment:

[E]ven if I disable the see suggestions for photos to post option, Google Maps still can access my photos and upload them to anywhere, without showing me a window to pick photos, right?

Would need to see the photos API for that. Till now, what is think is that, it's a native iOS interface to display photos.