First, your issue is not related to Jotai or NextJS or something. Circular dependency exists in every language.
From wikipedia:
In software engineering, a circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly. Such modules are also known as mutually recursive.
You need think about what circular dependency is, how you should design your state architecture.
Barrel file approach will not fix your issue, instead it will increase possible circular dependency issues. You can read this article to understand more about barrel files and why you shouldn't use them. Its written by creator of react-query.
If you are using NextJS, you can install circular dependency plugin (https://www.npmjs.com/package/circular-dependency-plugin) for webpack to make debugging easier.