No. Not at all. It is certainly not illegal to memorise opening lines. Whether this is worthwhile is another matter because as you say, "in 95% of games the opponent moves into an opening I don't know or more probably out of the opening books entirely".
If you are playing daily chess it is even acceptable to refer to opening books during the game. What you cannot do is put a position into an engine and use a machine to find the best move.
After playing games I always use the analysis tool to see what mistakes I made during the game. It's quite good fun to try various moves in the opening (particularly aggressive openings) and see what moves the computer would suggest.
For a few openings I have memorised some of stockfishes suggestions (mainly in the fried liver). In 95% of games the opponent moves into an opening I don't know or more probably out of the opening books entirely.
Will using these memorised moves cause me to get banned for cheating?
I am aware and mostly agree with the arguments against memorising openings.