This fixes compile errors trying to build bitcoin-tx and bitcoin-wallet without libevent, which were reported by Luke Dashjr in #18465
The fix avoiding bitcoin-tx dependency on libevent just adds a conditional build rule. This is implemented in the first commit (more details in commit description).
The fix avoiding bitcoin-wallet dependency on libevent requires minor code changes, because bitcoin-wallet (unlike bitcoin-tx) links against code that calls urlDecode / evhttp_uridecode. This fix is implemented in the second commit (again details in the commit description).