Where can I study what I really interested in as a postdoc researcher? I am a postdoc researcher in AI field. I was hired as a lead scientist in governmental project (named project A). I need to work on it at least eight hours on week days. 

Apart from the study in the project A, there is another topic which is really what I'm interested in (named project B). I started the project B last year, and since then, I studied it after business hour every day with several researchers.

The progress of the project B is somewhat nice and we'll submit a paper by this summer. I'm totally fascinated on the project B. I wish if all of what I have to do would be only the project B.

But it was OK. The project A is also interesting and I can write many paper thanks to the project A and B. Moreover, there are a lot of nice and intelligent friends here.

However, recently, PI assigned me to another project (project C). The project C is totally out of my interest and expertise.

I feel it might be time to leave. Unfortunately, I've not had enough record to get tenure position (but tenure track might be OK). I can go anywhere if I can focus on the project B. Unfortunately, to the best of my knowledge, it's very difficult to study what he/she wants as a postdoc researcher in CS field. 

So, my question is if there is a position allowing me to bring my own research topic and focus on it?

For instance,


applying for tenure track in some country
going to private companies to raise money (like sales person)
spin out and become CEO of startup company (don't laugh at me...)
persuade the PI to allow me to study the project B (0.01% success rate)


I can not open the location of my work place, but here is one of the worst competitive country on the planet to get tenure due to a low birth rate and long long economic depression... I guess I need go somewhere outside this country.
As a tenured professor you can choose your research area basically as you want (sometimes there may be some pressure from above to go into specific directions but where I am (Germany) there is freedom of research). However you will have many other things to do which can not always choose (particular courses to lecture, administration, meetings, committees...). So it is not like you can do the research you want to do all day. 

So, staying where area may not be as bad as you think now: You are assigned to project B now but 1. you may ask to also contribute to project A at the same time or 2. do a good job at project B and then ask your advisor to work on the project you would like. 

Personally I don't know anybody who funds his research on some private basis. One guy I know works in some company where his work is a bit close to research and he manages to teach courses at the university and publish papers and books. I don't know if he works part time or not...  In Germany you need the title "Privatdozent" to do so or get a "Lehrauftrag" each term.