Replace GEOS function calls by QgsGeometry class methods

I have realized that there's potentially a problem here: 'geom' variable may be a pointer directly from QgsFeature. We shall not modify the feature's geometry in place - we need to create a clone like when doing coordinate transform earlier in the same function. I understand that we are not really changing the shape, just fixing the geometry, but the geometry data should not be modified at all. Ideally the feature should be passed around as "const" reference - something to fix in QGIS 3.