Is there a way to check the file size after encoding before encoding, or a way to automatically adjust the bitrate by specifying the file size?
Not as a function.
You can specify the bitrate in "Quality" of "Render Settings" on the Deliver page, so it seems good to calculate based on that.
Also, if you only need to know the capacity roughly, you can calculate it somewhat easily by combining it with the render setting preset.
Try setting the capacity per minute for the bitrate as the name of the preset, such as "30MB/min" or "60MB/min", for which the bitrate is set in custom render settings.