Detect distances over 255cm with EV3 ultrasonic sensor? In my use case, I have to detect things about 3-4 meters. I don't need to be accurate, +-2 or 3cm is enough. The EV3-G and most other places have a max distance of 255cm, which I understand that it is a protocol limitation.

But is there a software solution, e.g. controlling send/receive with software and calculate on the main brick? Best if it is in the form of EV3-G custom blocks.
It is not a protocol limitation. It is a sensor limitation. There is a microcontroller on the LEGO EV3 Ultrasonic sensor that cannot be updated so there is no way to measure more than that. So to measure more than 255cm, a 3rd party sensor is needed, e.g. https://mindsensors.com.