There is no such thing as a USB 2.0 or USB 3.x extension cable because the USB specifications do not allow for such cables. The cable may have USB looking connectors on each end that will mate with USB devices but that doesn't make it a USB cable.
I extend a USB 2.0 port to connect a USB 2.0 device, but I actually use a USB 3.0 extension cable. Is the limit 3m or 5m ?
Again, extension cables violate the spec but if you have a USB 3.x device cable then the limit will be 3 meters. There are USB 3.x compliant cables that are over 3 meters in length but these are not for consumer devices, they are for industrial use. These cables lack the USB 2.0 pins for backward compatibility and pins for power since the voltage drop would be too much to stay in the specified range.
Or, I use a USB 2.0 extension to connect to a USB 3.0 hub, connecting
USB 3.0 devices (with reduced speed of course). 3m or 5m?
USB 2.0 cables remain USB 2.0 cables even if used to connect USB 3.x devices. The length of the cable will be limited to 5 meters. I have seen cables for USB 2.0 devices that go beyond this length but I don't recall if this is in the USB spec or not. They work by having a repeater block in the middle, kind of like a one port hub. They overcome the voltage drop problem with a voltage pump, trading current to get more voltage. At some point the voltage drop, signal delay, and so on becomes too much and the USB signal can't be repeated any more.
Yet again, I plug in a full speed USB 3.0 hub in a USB 3.0 port, but
all devices connected to the hub are actually USB 2.0. 3m or 5m?
For a cable to be a USB 3.x cable it has to meet the USB 3.x spec, meaning it has to stay under 3 meters. Because the USB 2.0 signal is using conductors in the USB 3.x cables that are distinct from the USB 3.x conductors it is possible to have a USB 3.x cable that is longer than 3 meters but it does so by not including the USB 2.0 conductors. That means the USB 2.0 devices plugged into the USB 3.x hub connected to the host computer by a cable longer than 3 meters will not work. If the USB 3.x cable to the hub is under 3 meters then it can keep the USB 2.0 conductors, and the USB 2.0 cables from the hub can then be 5 meters.
If we add USB4 in the mix then things get even more complicated. USB4 appears to allow for (perhaps require) a USB hub to contain it's own USB controller, that means a lot of cable length limits would no longer apply. An optical USB4 cable (optical in the middle, the ends still have copper connectors) can be 60 meters long. Then the cable length limits for USB 2.0 start from the hub, not the host computer, meaning 5 meters from there.
Did that clear things up? Perhaps not. I just hope I got this all correct.