Assuming you have a fairly standard on-bike set of tools, I would have tried the cable ties first as well.
Sometimes you can get the pawls to engage again by dropping the bike, and the shock drops one into place. If not, try rotating the wheel 90 degrees because some designs only have two pawls.
If the freehub engages, then carefully ride while maintaining a smooth circular pedal stroke. Do not coast at all and do not backpedal. Pulling up at a stop sign or red light can cause the pedal pressure to drop and the hub may disengage.
If the pawl will not engage, you have other options but they're getting invasive. The goal is to bind up the cassette against the wheel's hub in such a way it turns at the same time.
- Do you have any cord or rope? I have a short 2 metre length of braided cord, useful for securing loads to my bike or my backpack. Could wind this between the spokes and the biggest cog and tighten down, to wedge the hub against the cassette. Would have to be tightly packed in to provide enough resistance to your pedal power, and may need cutting or burning out once home.
- I also carry a couple of velcro cable ties around 200mm long and 15mm wide. They make great ziptie replacements and are reusable. You might have been able to secure the cassette to the drive-side spokes with some of them.
- Last resort - sacrifice a spoke or two to get some stout wire. Ideally you'd have spare spokes taped to your chainstay, but stealing a live spoke from your wheel might provide enough wire to secure the cassette to the remaining spokes.
You could also use your front derailleur inner cable, and use the limit screws to fix the mech in the preferred location. Not ideal if you have 1x or hills to climb.
You might use some clothing like a sock to wedge between your cassette and freehub, though this will probably ruin the item for future use.
Also look around for some road debris - there may be something around that can be used. Rurally there may be fencing wire offcuts or similar, or perhaps your bike lock has some way of binding up the cassette and hub. A cable lock could be a substitute for string. If you're near any shops/garages/homes then consider knocking on the door and asking for some assistance.
A split ring off your keys might seem useful but they tend to be weak.
If you're riding with someone else you can get a tow. This uses a spare inner tube as a tow strap, where the front rider acts as a tractor and ties the inner tube to their seat post. The towed (you) holds the towrope in one hand which allows a quick release should anything go wrong. Never tie two bikes together for towing You might have to cut the tube so its one long pipe to get the length required. Or use a belt, rain jacket, or other surplus clothing. Towing means gentle riding with no surging or out of the saddle efforts. Towing up a hill is really hard work so you will owe your tractor a meal.
Finally there are options like scootering along on the bike, catching a bus/train if there's a convenient route, calling a taxi/uber/someone with a car, hitching, walking, or making the Phonecall-of-Shame to your nearest and dearest for a lift.
If you are walking, consider that 5~6 km/h on the flat would be fair time, and walking in road cleats will slow you down. Scootering should be 8-10 km/h. If you're 50 km from home, that's going to be 10 hours walking minimum, plus rest stops and food would make it more likely 15 hours.
My longest walk was a flat tubular tyre, and I walked 15 km, the equivalent of 30 minutes ride. It took over 3 hours though that did include a pie-stop. There was no repairing that failure on the roadside, and it was pitch black night by the time I got home.