Note: Original Question:
Is it ever normal to vent LOX from spacecraft with active engines?
First, to establish the ground truth, on January 13th, 2024 at an address at Starbase in Texas, Elon Musk said...
So flight Flight 2 actually almost made it to orbit. So in fact ironically if it had a payload it would have made it to orbit because the reason that it actually didn't quite make it to orbit was we vented the liquid oxygen, and the liquid oxygen ultimately led to fire and an explosion, because we wanted to vent the liquid oxygen because we normally wouldn't have that liquid oxygen if we had a payload. So, ironically if it had a payload it would have reached orbit.
We can see from the second part of his statement...
we normally wouldn't have that liquid oxygen if we had a payload
... that venting O2 is "not normal".
To understand if venting O2 would have been a normal or "necessary procedure" for this Starship test, we have to engage in some speculation. We can speculate that it would be desirable for Starship to reach orbit with no excess propellant in its tanks, since it would need to be as light as possible for reentry. We can also speculate that it would be better to dump O2 while under power because dumping it after engine cutoff might destabilize the orbiting ship. In that case, the act of dumping propellant could be explained as a normal reaction to flight control projecting that Starship would reach orbit with too much propellant remaining in its tanks.
To validate this theory, we can do some napkin-math analysis of the OFT2 broadcast flight telemetry.
For example, we can base our analysis on this chart posed on Twitter/X and use it to extrapolate the velocity that Starship might have reached if it continued its burn without the LO2 dump.

This extrapolation indicates that Starship was on track to reach a speed of 27700 km/h or 7694 m/s. Let's assume, for the moment, that this is accurate (it might not be).
Is this enough? To achieve, for example, a 100/250 elliptical orbit, the velocity at perigee would need to be 7893 m/s. Therefore, it appears that the version of Starship used for OFT2 was 7893-7694=199 m/s short of reaching the perigee velocity for a 100/250 initial elliptical orbit.
As a point of interest, following the initial launch burn, a fully operational Starship would need to do a circularization burn at the elliptical orbit's apogee to achieve a circular orbit at 250km. Delta-v required for that burn is about 46 m/s. Then it would need to do a similar burn to deorbit. Finally, it might need around 100 m/s of delta-v to decelerate and hover briefly for the tower catch. $199+46+46+100 = 391 m/s$. 391 m/s is a rough estimate of the improvement in delta-v needed for Starship to be able to complete, for example, a complete refilling mission with zero payload (according to these back-of-the-envelope quality calculations).
To conclude, this napkin-math analysis indicates that the version of Starship that was used for OFT2 had insufficient delta-v, even without any payload, to reach a 100/250 elliptical orbit. Therefore, it would not have made sense for Starship to dump propellant to prevent it from being too heavy during reentry.
Disclaimer: No one should place their blind trust in this analysis or in the chart that was posted on Twitter/X. Anyone who wants to have an accurate understanding of Starship's current level of progress is strongly encouraged to do their own independent analysis.
Follow-up...
I learned of a number of situations when venting is done:
Rockets vent before launch to remove any excess gases or fuel vapors that may have built up in the fuel and oxidizer tanks
Propulsive venting in flight is used to support ullage (positioning of propellants towards the bottom of the stage in preparation for engine start/restart). (ref)
Rockets vent when the vehicle is in space to prevent pressure build up within the tanks due to boil off.
Second Follow-up
SpaceX issued an Feb 26, 2024 update that stated
At vehicle separation, Starship’s upper stage successfully lit all six Raptor engines and flew a normal ascent until approximately seven minutes into the flight, when a planned vent of excess liquid oxygen propellant began. Additional propellant had been loaded on the spacecraft before launch in order to gather data representative of future payload deploy missions and needed to be disposed of prior to reentry to meet required propellant mass targets at splashdown.
A leak in the aft section of the spacecraft that developed when the liquid oxygen vent was initiated resulted in a combustion event and subsequent fires that led to a loss of communication between the spacecraft’s flight computers. This resulted in a commanded shut down of all six engines prior to completion of the ascent burn, followed by the Autonomous Flight Safety System detecting a mission rule violation and activating the flight termination system, leading to vehicle breakup. The flight test’s conclusion came when the spacecraft was as at an altitude of ~150 km and a velocity of ~24,000 km/h, becoming the first Starship to reach outer space.
Additionally, on Feb 26th the Federal Aviation Administration (FAA) closed its investigation into the second Starship/Super Heavy launch in November. The FAA stated in its letter to SpaceX several corrective actions including
...operational changes eliminating pre-second engine cutoff propellant dumps...