Welcome to Aviation SE.
There is no need or reason to turn when going through clouds. Aircraft frequently climb (or descend) and change direction at the same time. If it happens in cloud, it's just a co-incidence.
As an example, on an approach, ATC often issue instructions such as:
Turn left heading 300 degrees, descend and maintain 4000 feet.
The pilot will start turning towards heading 300 and start descending at the same time.
Resume own navigation, climb flight level 370.
Following a previous instruction to deviate from the heading on the flight plan, the pilot is now cleared to turn back onto the planned track and climb to the planned flight level.
There is a high probability that you will see aircraft turning in clouds since arrival and departure routes, which is when most of the turning, climbing and descending is done, are when you are most likely to see aircraft in and out of clouds and manoeuvring.
In cruise, when an aircraft turns, it is also common to descend or climb since the altitude flown according to the heading is determined by the quadrantal and hemispheric rules.