Not Quite Roman Ternary

Java 10, 120 113 112 109 107 102 92 bytes

n->{var r="|";for(var c='1';n++>0;c+=c>64?1:c*4%22%9,n/=3)r=n%3<1?c+r:n%3>1?r+c:r;return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-6 bytes thanks to @Arnauld directly, by getting rid of i.
-10 bytes thanks to @ceilingcat.

Order of output: Highest-to-lowest, |-delimiter, lowest-to-highest.

Explanation:

Try it online.

n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(var c='1';  //  Character, starting at '1'
      n++>0       //  Loop as long as `n` is larger than 0
                  //  Increasing it by 1 with `n++` at the start of every iteration
      ;           //    After every iteration:
       c+=        //     Change character `c` to:
          c>64?   //      If the current `c` is an uppercase letter:
               1  //       Simply go to the next letter using `c+=1`
              :   //      Else:
               c*4%22%9,
                  //       Change '1' to '3', '3' to '9', or '9' to 'A'
       n/=3)      //     Integer-divide `n` by 3
     r=           //   Change the result to:
       n%3<1?     //    If `n` modulo-3 is 0:
        c+r       //     Prepend the character to the result
       :n%3>1?    //    Else-if `n` modulo-3 is 2:
        r+c       //     Append the character to the result
       :          //    Else (`n` modulo-3 is 1):
        r;        //     Leave `r` unchanged
   return r;}     //  Return the result-String

Python 3, 103 99 91 bytes

4 bytes thanks to Lynn.

8 bytes thanks to ovs.

def f(n,s="|",b=0):c=('139'+chr(b+62)*b)[b];return n and f(-~n//3,[s,s+c,c+s][n%3],b+1)or s

Try it online!

Credits to xnor for the logic.


JavaScript (ES6), 82 80 79 bytes

Outputs in lowercase, which should hopefully be fine.

f=(n,s=(k=4,'|'),c=++k>8?k.toString(36):++k-5)=>n?f(++n/3|0,[c+s,s,s+c][n%3]):s

Try it online!

Similar to Leaky "Ninja Master" Nun's answer and also based on xnor's answer.

Digit conversion

We start with k = 4. While k is less than 9, we increment it twice at each iteration and subtract 5. After that, we increment it only once and convert it to base-36.

  k  | ++k > 8       | k.toString(36) | ++k - 5  | result
-----+---------------+----------------+----------+--------
  4  | k=5  -> false |                | k=6 -> 1 | 1
  6  | k=7  -> false |                | k=8 -> 3 | 3
  8  | k=9  -> true  | '9'            |          | '9'
  9  | k=10 -> true  | 'a'            |          | 'a'
  10 | k=11 -> true  | 'b'            |          | 'b'
 ... | ...           | ...            | ...      | ...