I suspect the issue relates to the very real difference existing between geometry
objects, existing on a plane map surface, and geography
objects, existing on a curved globe surface.
It is always more accurate (but slower) to do calculations with geography
types on a globe. Projecting features from a globe onto a plane always incurs distortion.
Looking at your SQL code, on the 3rd line you do cast to geography
but for the "incomplete" reasons. You do it to use meters instead of degrees for the distance measure, and that is good. You should also do it because you get more accurate results.
Now, in the 1st line of your SQL code, you make a point out of coordinate parameters, but it is by default a geometry
and so you end up not comparing like with like. Try casting the point you make to geography
and see what happens.
Like this, i think:
ST_SetSRID(ST_MakePoint($1, $2),4326)::geography
If you draw circles using GMaps, they are probably not representing true circles on the globe. If "GMaps" (not sure what you mean, exactly) uses the Web Mercator projection, then a drawn circle really represents an "egg" shape on the globe, with the pointed end up north. That's how the Mercator projection distorts things -- things get hugely stretched as one moves away from the equator.
Best Answer
I would go with CIRCULARSTRING. You already know the coordinates of start point and end point, and the coordinates for the peak radius can be easily calculated.
Thus, the half of your desired ellipse could be represented as
The other half being the same with negative values of peak radius
Union those two halfs and you should have your ellipse complete.