Yes, a plugin would be the right thing. However, you have to consider a bit how to do this. Using the file post save processor allows you to update this completely, which is great. But if you want to calculate the loudness adjustment also for the entire album it will be difficult. There is not yet a post album save processor unfortunately. For this you’d register manual context menu action with
register_album_action, see http://picard-docs.musicbrainz.org/en/extending/plugins.html
For the tags I would actually recommend following the Replaygain 2.0 Spec, which is based upon EBU R-128. That way you automatically get good player support, no need to invent your own. The tags for this are supported by Picard even.
You can of course use ffmpeg, than write the tags with your plugin. But there are also some great tools which do this, e.g. I use loudgain by @Moonbase, or there is the very similar regained by @kepstin.
I would love to see a good plugin for Replaygain 2.0 handling and get rid of the old Replaygain plugin that still exists.