Нow to start an academic career if you got your PhD five years ago and didn't do science for these five years? I think that it's too late for postdoc. Also, I think that my PhD thesis is weak and not many people would be interested. What is the way to start academic or near-academic career, if not teaching? Thesis is on CS and applied mathematics. I live in Ukraine and could move if it's needed. Volunteering or studying for some period is also acceptable.
I don't know what might be available in or near Ukraine, but can offer two possibilities that might be open to you.
The first is a long-term plan that assumes you have sufficient resources (job, money, time) to start some research. To do this efficiently, you might need to be in a place that has one or more local universities where you could make some contacts and start some collaborative activities. But a professor (maybe one you know) might be interested in working with you on some projects of mutual interest. If you can establish yourself as an effective researcher, you might find a way back in to a university. Your old thesis advisor might be able to offer some possibilities for collaboration. But you wouldn't/needn't be either an employee or student to do this. Your status as an &quot;independent researcher&quot; is enough.
The second idea would work in the US and possibly elsewhere, but requires the ability/desire to teach. Here we have a large number of Colleges that are not focused primarily on research but, rather, on undergraduate education. People are expected to do some research, but are expected to excel at teaching. Moving around might raise language issues, of course, for this type of position. If you were teaching at such a college and it were located in a place with other, more research focused, universities, you might be able to establish some collaborations as suggested above. And, the life of a teaching professor can be pretty nice in the right place in any case.
In the internet/covid age, however, things are a bit weird. The internet provides a way to do remote collaboration, but the pandemic makes it harder to make contacts. Attendance at conferences is often a good way to do that.