Yes, you can enable Google Photos backup of phone B from phone A if they are both signed in to the same Google account. Here are the steps you can follow:
Open Google Photos on phone A.
Tap on your account avatar in the top right corner of the screen.
Select "Settings" from the drop-down menu.
Under "Google Photos settings," tap on "Back up & sync."
Toggle the switch next to "Back up & sync" to the "On" position if it's not already on.
Scroll down to "Back up device folders" and tap on it.
Select the folders on phone B that you want to back up to Google Photos.
If prompted, give Google Photos permission to access your phone's storage.
Wait for the backup to complete.
Once you complete these steps, your selected folders on phone B will be backed up to Google Photos, and you can access them from any device signed in to your Google account.