Modified cosmology from extended entropy with varying exponent