There are often many people who switch careers midway. Some from software engineering to a product management role which is quite popular given relevance of previous career to current career. Another example is software engineer to a data scientist. Some might be less relevant but still have the same corporate setup, for example, a software engineer to supply chain engineer. Some might be irrelevant like software engineer transitioning to teaching high school physics but transitioning is still easy. Some might be super irrelevant and 'risky' like software engineer with 5-7 years of experience, going to study masters in physics then a PhD then couple of postdocs and finally becoming a professor in say high energy physics.
I exactly wanted to know about the last case, how can a present software engineer with >4 years of experience in software engineering, pursue physics and establish a successful career (PhD, post-docs, then professorship) in physics academia.