How does google maps know that I've taken pictures? Yesterday I've visited a restaurant. The restaurant had a beautiful garden and colorful plants. So I took several pictures there. Today, Google Maps sent me a notification and offered me to share those pictures as I've taken for that restaurant.

How does Google Maps know that I've taken pictures there? Does the app regularly check(while the app is running) my pictures and their location without my knowledge? If so, then Google Maps can also upload those pictures to somewhere without even asking me? So if I allow access to my photos for an app, does that mean the app can access my photos without showing a "BROWSE" or something like that and upload to somewhere? I though iOS API needs photos to be picked by user to be shared by an app. Otherwise any app that has proper access permissions can access to all of my photos and then may upload all of them to cloud, whithout my knowledge, right?

Edit: Ok, I'm having hard time to explain myself. I know if Google Maps has access permissions to photos, then it can access photos. That's not the issue here. The problem is that: My phone is locked and sitting on the table. Then I get a notification from Google Maps, asking to share the photos I've taken yesterday at the restaurant I've visited! Not only that, when I click the notification, Google Maps opens up with a view with already selected photos which all taken at the specified location. This is only possible if I opened the Google Maps app, after taking photos, which I did for getting back to home. The problem is, when I open the Google Maps or any other app that has access permission to photos, does this mean all those app can access all of my photos, any time(if app is running in foreground)? I thought apps need to call some iOS APIs to show me the thumbnails, then only the photos I've checked will be delivered to app. That is, I thought apps can only access the photos I've picked from the thumbnail view and the thumbnail view is mandatory and handled by iOS, just like passcode and touchID(apps can't read users' fingerprint or passcode, it's all handled by iOS).
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.