I have developed Python scripts to extract locations, pitch, roll, and yaw from DJI drone images and automatically georeference those images. I would like to be able to do the same with my phone camera. I have installed on my phone GPS Essential which will geotag an image. GPS Essentials will also display the camera pitch, roll, and yaw on a heads-up display on their camera but it does not write those values to the camera's metadata. I am looking for an Android camera app that will store geotag data in addition to the pitch, roll, and yaw at the time of image capture.
As we figured in the comments on the question, Open Camera seems to fit the bill. This Android app is open source and available at F-Droid as well as at Google Play. I can highly recommend this app, using it for years: best quality, no nagging (neither ads nor tracking), very configurable – feature-rich but still not bloated or overgrown. You can even use an external microphone for video recordings if you wish.
Now for the special feature you requested I never noticed Open Camera well supports. It can be found in the settings (reachable via the "gear" icon in the camera overlay), right below "Photo Settings" and "Video Settings", inside the "Location Settings" item (see below screenshot). In English it seems to use the phrase "Store yaw, pitch, and roll", while in other languages it might look different (e.g. in German it writes "Eigentliche Eulerwinkel speichern", which according to Wikipedia's Euler angles article seems to be exactly that.