By saying scientific book I mean for instance: let's say someone wants to write a book for Algorithms targeting CS undergraduate/graduate university students
To get an academic position you need to publish research, which means creating new knowledge. This type of knowledge is usually published in peer reviewed journals, not in books. On occasion, it may be published in book form, in what is usually referred to as a research monograph, which is distinct from the kind of book you are describing, usually referred to as a textbook.
Writing a textbook will have very limited value in helping you launch an academic career. It might be beneficial as something that complements a body of research published in peer reviewed journals, but on its own, it won’t count for much in the disciplines you listed. Moreover, writing a textbook is a very time-consuming task that has a high opportunity cost. If you spend the time it takes to write a textbook, you would be giving up a huge amount of time that would have been available for you to do and publish research. That would put you at a significant competitive disadvantage relative to other people at a similar career stage who are not writing textbooks.
All things considered, for early career researchers writing a textbook is not a good way to advance your academic career.