Tyvek is supposed to keep the outside elements from getting through to the substrate.
On a new construction home, we'd put flashing tape around all windows before vinyl. Then cap them with metal trim.
Remodel, we'd cap all windows and door trim with metal trim coil and caulk it to the J-channel so no weather can infiltrate.