Rarely. The water in the toilet trap seals the bowl off from the sewer. Most worms people find in a toilet hatched right there. The exception is a cracked or broken sewer line, which can let soil, water, and earthworms into the pipe, especially after heavy rain.
Every toilet has a built-in trap, a curve that always holds water. Anything coming up from the sewer has to get past that water, and larvae that need air cannot. So drain fly and midge larvae in a bowl almost always came from the toilet, the tank, or the film under the rim. They did not come from the city sewer.
A damaged lateral is different. When clay joints separate or cast iron cracks, soil and groundwater leak in, and earthworms can follow the moisture. North Texas clay soil swells after heavy rain and shrinks in drought, which opens and closes those gaps.
Earthworms after a storm, or worms in a toilet flushed every day, point to the pipe rather than the bowl. Cleaning the bowl will not fix that. A camera inspection shows whether the line has a break, a separated joint, or roots holding a gap open. If the camera finds a clean, intact line, the source is inside the house after all.
Nuflow DFW is a licensed trenchless sewer contractor serving 25 Dallas-Fort Worth cities, RMP# 46694. Our camera inspection shows where the line is open, and a pipe repair closes it. You keep the footage. Call (469) 701-0597.