An illustration of your problem:

your weight training may improve or worsen the problem.
It depends on which exercises you do and how you do them.
First thing is you want to "stop" training your chest.
That is "stop" doing bench press. When doing bench press use a narrow grip that shifts the load onto the triceps muscles instead. Prefer (narrow) push-ups to bench press.
Here are the muscles you want to train instead:

The rhomboids work together to pull and squeeze the shoulder blades towards the spine. The rhomboids also help us to maintain good posture.

The lower trapezius muscles pull the shoulder blades downward.
So you want to pull your shoulder blades together and downward against an external force. You do this eg. by training rows and facepulls and overhead trap pulls.
Do not use too much weight when you row. Move the weight slowly. Imagine someone poking a finger in between your shoulderblades. You want to squeeze this finger with your shoulderblades.
When you do pull downs initiate the movement by pulling your shoulder blades down. Do not use too much weight. Move the weight slowly and controlled. Perfect form must always be first priority. Focus on pulling the shoulder blades down.
Here is an example weight training program:
Workout A
- Squat: 3x5
- Narrow push-ups and or dips (or narrow bench press): 3 sets
- Seated rows: 3x10
- Facepulls followed by overhead trap pulls: 3x10
Workout B
- Squat: 3x5
- Deadlift: 1x5
- Overhead press: 3x5
- V bar pulldowns: 3x10
- Facepulls followed by overhead trap pulls: 3x10
You alternate A and B 3 times a week.
The main points of this program:
- Do a lot more pulling than pushing.
- Use triceps for pushing instead of chest.
- Alternate between horizontal pulling (shoulderblades together) and vertical pulling (shoulderblades down).
You should keep an elastic resistance band at work and do band pull-aparts troughout the day.
It may be a good idea to have a suspension trainer set-up at home.
That way you can do rows and facepulls and overhead trap pulls at home.
Occasionally (in particular day after push-ups or bench press) do some wall angels.
Also do some Thoracic Extensions on Foam Roller occasionally.
Also anterior pelvic tilt or lordosis may predispose you for kyphosis.
Prolonged sitting may cause anterior pelvic tilt.
To counteract this you should strengthen your glutes and abs.
Glutes should be covered by squats. Fairly deep low bar squats with a fairly wide stance is the best in this respect.
For abs planks and sideplanks on the days you are not doing weight training is a good idea. Glute bridges on some of these days may also be a good idea.