You don't *have* to disconnect the solenoid to replace the engine in a 2006 Jeep Liberty 3.7L 4x4, but it's highly recommended. The solenoid is usually part of the starter motor, and while it's not directly in the way of the engine, disconnecting the battery's negative terminal (which achieves the same effect of disconnecting the solenoid circuit) is standard procedure before working on any major engine component. This prevents accidental shorts and ensures your safety.
Therefore, while technically not strictly necessary to physically disconnect the solenoid itself, disconnecting the battery is a crucial safety precaution and generally part of the engine removal process.